<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="generator" content="ApiGen 2.7.0" />
	<meta name="robots" content="noindex" />

	<title>File lib/php/externals/phpmailer/class.phpmailer.php | nort</title>

	<script type="text/javascript" src="resources/combined.js?1481722677"></script>
	<script type="text/javascript" src="elementlist.js?1094816827"></script>
	<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?1567499433" />

</head>

<body>
<div id="left">
	<div id="menu">
		<a href="index.html" title="Overview"><span>Overview</span></a>


		<div id="groups">
			<h3>Packages</h3>
			<ul>
				<li><a href="package-App.html">App<span></span></a>
						<ul>
				<li><a href="package-App.Saas.html">Saas</a>
						</li>
				<li><a href="package-App.saas.html">saas</a>
						</li>
				<li><a href="package-App.SaaS.html">SaaS<span></span></a>
						<ul>
				<li><a href="package-App.saas.Logic.html">Logic</a>
						</li>
				<li><a href="package-App.SaaS.SaaS.html">SaaS</a>
						</li>
				<li><a href="package-App.Saas.Tables.html">Tables</a>
						</li>
				<li><a href="package-App.Saas.Vo.html">Vo</a>
						</li>
							</ul></li></ul></li>
				<li><a href="package-aqua.html">aqua<span></span></a>
						<ul>
				<li><a href="package-aqua.tools.html">tools<span></span></a>
						<ul>
				<li><a href="package-aqua.tools.Monitor.html">Monitor</a>
						</li>
							</ul></li></ul></li>
				<li><a href="package-flashservices.html">flashservices<span></span></a>
						<ul>
				<li><a href="package-flashservices.adapters.html">adapters</a>
						</li>
				<li><a href="package-flashservices.debug.html">debug</a>
						</li>
				<li><a href="package-flashservices.exception.html">exception</a>
						</li>
				<li><a href="package-flashservices.filters.html">filters</a>
						</li>
				<li><a href="package-flashservices.io.html">io</a>
						</li>
				<li><a href="package-flashservices.sql.html">sql</a>
						</li>
				<li><a href="package-flashservices.util.html">util</a>
						</li>
							</ul></li>
				<li><a href="package-Mekayotl.html">Mekayotl<span></span></a>
						<ul>
				<li><a href="package-Mekayotl.core.html">core</a>
						</li>
				<li><a href="package-Mekayotl.database.html">database<span></span></a>
						<ul>
				<li><a href="package-Mekayotl.database.dal.html">dal</a>
						</li>
				<li><a href="package-Mekayotl.database.mysql.html">mysql</a>
						</li>
				<li><a href="package-Mekayotl.database.sqlite.html">sqlite</a>
						</li>
							</ul></li>
				<li><a href="package-Mekayotl.tools.html">tools<span></span></a>
						<ul>
				<li><a href="package-Mekayotl.tools.render.html">render<span></span></a>
						<ul>
				<li><a href="package-Mekayotl.tools.render.html.html">html</a>
						</li>
							</ul></li>
				<li><a href="package-Mekayotl.tools.renders.html">renders</a>
						</li>
							</ul></li></ul></li>
				<li class="active"><a href="package-None.html">None</a>
						</li>
				<li><a href="package-PHP.html">PHP</a>
						</li>
				<li><a href="package-PHPMailer.html">PHPMailer</a>
						</li>
				<li><a href="package-Services.html">Services<span></span></a>
						<ul>
				<li><a href="package-Services.JSON.html">JSON</a>
						</li>
							</ul></li>
				<li><a href="package-Swift.html">Swift<span></span></a>
						<ul>
				<li><a href="package-Swift.ByteStream.html">ByteStream</a>
						</li>
				<li><a href="package-Swift.CharacterStream.html">CharacterStream</a>
						</li>
				<li><a href="package-Swift.Encoder.html">Encoder</a>
						</li>
				<li><a href="package-Swift.Events.html">Events</a>
						</li>
				<li><a href="package-Swift.KeyCache.html">KeyCache</a>
						</li>
				<li><a href="package-Swift.Mailer.html">Mailer</a>
						</li>
				<li><a href="package-Swift.Mime.html">Mime</a>
						</li>
				<li><a href="package-Swift.Plugins.html">Plugins</a>
						</li>
				<li><a href="package-Swift.Transport.html">Transport</a>
						</li>
							</ul></li>
			</ul>
		</div>

		<hr />


		<div id="elements">
			<h3>Classes</h3>
			<ul>
				<li><a href="class-AcknowledgeMessage.html">AcknowledgeMessage</a></li>
				<li><a href="class-AMFDeserializer.html">AMFDeserializer</a></li>
				<li><a href="class-BasicGateway.html">BasicGateway</a></li>
				<li><a href="class-ByteArray.html">ByteArray</a></li>
				<li><a href="class-CommandMessage.html">CommandMessage</a></li>
				<li><a href="class-ErrorMessage.html">ErrorMessage</a></li>
				<li><a href="class-Executive.html" class="invalid">Executive</a></li>
				<li><a href="class-Gateway.html" class="invalid">Gateway</a></li>
				<li><a href="class-HtmlParser.html">HtmlParser</a></li>
				<li><a href="class-MethodTable.html">MethodTable</a></li>
				<li><a href="class-PageableRecordSet.html">PageableRecordSet</a></li>
				<li><a href="class-PHPMailer.html">PHPMailer</a></li>
				<li><a href="class-ProfilingHeader.html">ProfilingHeader</a></li>
				<li><a href="class-ReCaptchaResponse.html">ReCaptchaResponse</a></li>
				<li><a href="class-RecordSet.html">RecordSet</a></li>
				<li><a href="class-RemotingMessage.html">RemotingMessage</a></li>
				<li><a href="class-Twitter.html">Twitter</a></li>
			</ul>



			<h3>Exceptions</h3>
			<ul>
				<li class="active"><a href="class-phpmailerException.html">phpmailerException</a></li>
			</ul>


			<h3>Functions</h3>
			<ul>
				<li><a href="function-__env.html">__env</a></li>
				<li><a href="function-__setUri.html">__setUri</a></li>
				<li><a href="function-_recaptcha_aes_encrypt.html">_recaptcha_aes_encrypt</a></li>
				<li><a href="function-_recaptcha_aes_pad.html">_recaptcha_aes_pad</a></li>
				<li><a href="function-_recaptcha_http_post.html">_recaptcha_http_post</a></li>
				<li><a href="function-_recaptcha_mailhide_email_parts.html">_recaptcha_mailhide_email_parts</a></li>
				<li><a href="function-_recaptcha_mailhide_urlbase64.html">_recaptcha_mailhide_urlbase64</a></li>
				<li><a href="function-_recaptcha_qsencode.html">_recaptcha_qsencode</a></li>
				<li><a href="function-adapterMap.html">adapterMap</a></li>
				<li><a href="function-amfErrorHandler.html">amfErrorHandler</a></li>
				<li><a href="function-classLoaderAction.html">classLoaderAction</a></li>
				<li><a href="function-debugAction.html">debugAction</a></li>
				<li><a href="function-deserializationAction.html" class="invalid">deserializationAction</a></li>
				<li><a href="function-executionAction.html" class="invalid">executionAction</a></li>
				<li><a href="function-file_put_contents.html">file_put_contents</a></li>
				<li><a href="function-HtmlParser_ForFile.html">HtmlParser_ForFile</a></li>
				<li><a href="function-HtmlParser_ForURL.html">HtmlParser_ForURL</a></li>
				<li><a href="function-is_a.html">is_a</a></li>
				<li><a href="function-json_decode.html">json_decode</a></li>
				<li><a href="function-json_encode.html">json_encode</a></li>
				<li><a href="function-mapRecordSet.html">mapRecordSet</a></li>
				<li><a href="function-microtime_float.html" class="invalid">microtime_float</a></li>
				<li><a href="function-ob_get_clean.html">ob_get_clean</a></li>
				<li><a href="function-patched_array_search.html" class="invalid">patched_array_search</a></li>
				<li><a href="function-recaptcha_check_answer.html">recaptcha_check_answer</a></li>
				<li><a href="function-recaptcha_get_html.html">recaptcha_get_html</a></li>
				<li><a href="function-recaptcha_get_signup_url.html">recaptcha_get_signup_url</a></li>
				<li><a href="function-recaptcha_mailhide_html.html">recaptcha_mailhide_html</a></li>
				<li><a href="function-recaptcha_mailhide_url.html">recaptcha_mailhide_url</a></li>
				<li><a href="function-reportExceptions.html">reportExceptions</a></li>
				<li><a href="function-securityAction.html">securityAction</a></li>
				<li><a href="function-serializationAction.html" class="invalid">serializationAction</a></li>
				<li><a href="function-strrstr.html">strrstr</a></li>
				<li><a href="function-strstrafter.html">strstrafter</a></li>
				<li><a href="function-toPhp.html">toPhp</a></li>
			</ul>
		</div>
	</div>
</div>

<div id="splitter"></div>

<div id="right">
<div id="rightInner">
	<form id="search">
		<input type="hidden" name="cx" value="" />
		<input type="hidden" name="ie" value="UTF-8" />
		<input type="text" name="q" class="text" />
		<input type="submit" value="Search" />
	</form>

	<div id="navigation">
		<ul>
			<li>
				<a href="index.html" title="Overview"><span>Overview</span></a>
			</li>
			<li>
				<a href="package-None.html" title="Summary of None"><span>Package</span></a>
			</li>
			<li>
				<a href="class-phpmailerException.html" title="Summary of phpmailerException"><span>Class</span></a>
			</li>
		</ul>
		<ul>
			<li>
				<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
			</li>
		</ul>
		<ul>
		</ul>
	</div>

<pre><code><a href="#1" id="1" class="l">   1: </a><span class="xlang">&lt;?php</span>
<a href="#2" id="2" class="l">   2: </a><span class="php-comment">/*~ class.phpmailer.php
</span><a href="#3" id="3" class="l">   3: </a><span class="php-comment">.---------------------------------------------------------------------------.
</span><a href="#4" id="4" class="l">   4: </a><span class="php-comment">|  Software: PHPMailer - PHP email class                                    |
</span><a href="#5" id="5" class="l">   5: </a><span class="php-comment">|   Version: 5.1                                                            |
</span><a href="#6" id="6" class="l">   6: </a><span class="php-comment">|   Contact: via sourceforge.net support pages (also www.worxware.com)      |
</span><a href="#7" id="7" class="l">   7: </a><span class="php-comment">|      Info: http://phpmailer.sourceforge.net                               |
</span><a href="#8" id="8" class="l">   8: </a><span class="php-comment">|   Support: http://sourceforge.net/projects/phpmailer/                     |
</span><a href="#9" id="9" class="l">   9: </a><span class="php-comment">| ------------------------------------------------------------------------- |
</span><a href="#10" id="10" class="l">  10: </a><span class="php-comment">|     Admin: Andy Prevost (project admininistrator)                         |
</span><a href="#11" id="11" class="l">  11: </a><span class="php-comment">|   Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
</span><a href="#12" id="12" class="l">  12: </a><span class="php-comment">|          : Marcus Bointon (coolbru) coolbru@users.sourceforge.net         |
</span><a href="#13" id="13" class="l">  13: </a><span class="php-comment">|   Founder: Brent R. Matzelle (original founder)                           |
</span><a href="#14" id="14" class="l">  14: </a><span class="php-comment">| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved.               |
</span><a href="#15" id="15" class="l">  15: </a><span class="php-comment">| Copyright (c) 2001-2003, Brent R. Matzelle                                |
</span><a href="#16" id="16" class="l">  16: </a><span class="php-comment">| ------------------------------------------------------------------------- |
</span><a href="#17" id="17" class="l">  17: </a><span class="php-comment">|   License: Distributed under the Lesser General Public License (LGPL)     |
</span><a href="#18" id="18" class="l">  18: </a><span class="php-comment">|            http://www.gnu.org/copyleft/lesser.html                        |
</span><a href="#19" id="19" class="l">  19: </a><span class="php-comment">| This program is distributed in the hope that it will be useful - WITHOUT  |
</span><a href="#20" id="20" class="l">  20: </a><span class="php-comment">| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
</span><a href="#21" id="21" class="l">  21: </a><span class="php-comment">| FITNESS FOR A PARTICULAR PURPOSE.                                         |
</span><a href="#22" id="22" class="l">  22: </a><span class="php-comment">| ------------------------------------------------------------------------- |
</span><a href="#23" id="23" class="l">  23: </a><span class="php-comment">| We offer a number of paid services (www.worxware.com):                    |
</span><a href="#24" id="24" class="l">  24: </a><span class="php-comment">| - Web Hosting on highly optimized fast and secure servers                 |
</span><a href="#25" id="25" class="l">  25: </a><span class="php-comment">| - Technology Consulting                                                   |
</span><a href="#26" id="26" class="l">  26: </a><span class="php-comment">| - Oursourcing (highly qualified programmers and graphic designers)        |
</span><a href="#27" id="27" class="l">  27: </a><span class="php-comment">'---------------------------------------------------------------------------'
</span><a href="#28" id="28" class="l">  28: </a><span class="php-comment"> */</span>
<a href="#29" id="29" class="l">  29: </a>
<a href="#30" id="30" class="l">  30: </a><span class="php-comment">/**
</span><a href="#31" id="31" class="l">  31: </a><span class="php-comment"> * PHPMailer - PHP email transport class
</span><a href="#32" id="32" class="l">  32: </a><span class="php-comment"> * NOTE: Requires PHP version 5 or later
</span><a href="#33" id="33" class="l">  33: </a><span class="php-comment"> * @package PHPMailer
</span><a href="#34" id="34" class="l">  34: </a><span class="php-comment"> * @author Andy Prevost
</span><a href="#35" id="35" class="l">  35: </a><span class="php-comment"> * @author Marcus Bointon
</span><a href="#36" id="36" class="l">  36: </a><span class="php-comment"> * @copyright 2004 - 2009 Andy Prevost
</span><a href="#37" id="37" class="l">  37: </a><span class="php-comment"> * @version $Id: class.phpmailer.php 450 2010-06-23 16:46:33Z coolbru $
</span><a href="#38" id="38" class="l">  38: </a><span class="php-comment"> * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
</span><a href="#39" id="39" class="l">  39: </a><span class="php-comment"> */</span>
<a href="#40" id="40" class="l">  40: </a>
<a href="#41" id="41" class="l">  41: </a><span class="php-keyword1">if</span> (<span class="php-keyword2">version_compare</span>(PHP_VERSION, <span class="php-quote">'5.0.0'</span>, <span class="php-quote">'&lt;'</span>))
<a href="#42" id="42" class="l">  42: </a>    <span class="php-keyword1">exit</span>(
<a href="#43" id="43" class="l">  43: </a>            <span class="php-quote">&quot;Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n&quot;</span>);
<a href="#44" id="44" class="l">  44: </a>
<a href="#45" id="45" class="l">  45: </a><span class="php-keyword1">class</span> PHPMailer
<a href="#46" id="46" class="l">  46: </a>{
<a href="#47" id="47" class="l">  47: </a>
<a href="#48" id="48" class="l">  48: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#49" id="49" class="l">  49: </a>    <span class="php-comment">// PROPERTIES, PUBLIC</span>
<a href="#50" id="50" class="l">  50: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#51" id="51" class="l">  51: </a>
<a href="#52" id="52" class="l">  52: </a>    <span class="php-comment">/**
</span><a href="#53" id="53" class="l">  53: </a><span class="php-comment">     * Email priority (1 = High, 3 = Normal, 5 = low).
</span><a href="#54" id="54" class="l">  54: </a><span class="php-comment">     * @var int
</span><a href="#55" id="55" class="l">  55: </a><span class="php-comment">     */</span>
<a href="#56" id="56" class="l">  56: </a>
<a href="#57" id="57" class="l">  57: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Priority</span> = <span class="php-num">3</span>;
<a href="#58" id="58" class="l">  58: </a>
<a href="#59" id="59" class="l">  59: </a>    <span class="php-comment">/**
</span><a href="#60" id="60" class="l">  60: </a><span class="php-comment">     * Sets the CharSet of the message.
</span><a href="#61" id="61" class="l">  61: </a><span class="php-comment">     * @var string
</span><a href="#62" id="62" class="l">  62: </a><span class="php-comment">     */</span>
<a href="#63" id="63" class="l">  63: </a>    <span class="php-keyword1">public</span> <span class="php-var">$CharSet</span> = <span class="php-quote">'iso-8859-1'</span>;
<a href="#64" id="64" class="l">  64: </a>
<a href="#65" id="65" class="l">  65: </a>    <span class="php-comment">/**
</span><a href="#66" id="66" class="l">  66: </a><span class="php-comment">     * Sets the Content-type of the message.
</span><a href="#67" id="67" class="l">  67: </a><span class="php-comment">     * @var string
</span><a href="#68" id="68" class="l">  68: </a><span class="php-comment">     */</span>
<a href="#69" id="69" class="l">  69: </a>    <span class="php-keyword1">public</span> <span class="php-var">$ContentType</span> = <span class="php-quote">'text/plain'</span>;
<a href="#70" id="70" class="l">  70: </a>
<a href="#71" id="71" class="l">  71: </a>    <span class="php-comment">/**
</span><a href="#72" id="72" class="l">  72: </a><span class="php-comment">     * Sets the Encoding of the message. Options for this are
</span><a href="#73" id="73" class="l">  73: </a><span class="php-comment">     *  &quot;8bit&quot;, &quot;7bit&quot;, &quot;binary&quot;, &quot;base64&quot;, and &quot;quoted-printable&quot;.
</span><a href="#74" id="74" class="l">  74: </a><span class="php-comment">     * @var string
</span><a href="#75" id="75" class="l">  75: </a><span class="php-comment">     */</span>
<a href="#76" id="76" class="l">  76: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Encoding</span> = <span class="php-quote">'8bit'</span>;
<a href="#77" id="77" class="l">  77: </a>
<a href="#78" id="78" class="l">  78: </a>    <span class="php-comment">/**
</span><a href="#79" id="79" class="l">  79: </a><span class="php-comment">     * Holds the most recent mailer error message.
</span><a href="#80" id="80" class="l">  80: </a><span class="php-comment">     * @var string
</span><a href="#81" id="81" class="l">  81: </a><span class="php-comment">     */</span>
<a href="#82" id="82" class="l">  82: </a>    <span class="php-keyword1">public</span> <span class="php-var">$ErrorInfo</span> = <span class="php-quote">''</span>;
<a href="#83" id="83" class="l">  83: </a>
<a href="#84" id="84" class="l">  84: </a>    <span class="php-comment">/**
</span><a href="#85" id="85" class="l">  85: </a><span class="php-comment">     * Sets the From email address for the message.
</span><a href="#86" id="86" class="l">  86: </a><span class="php-comment">     * @var string
</span><a href="#87" id="87" class="l">  87: </a><span class="php-comment">     */</span>
<a href="#88" id="88" class="l">  88: </a>    <span class="php-keyword1">public</span> <span class="php-var">$From</span> = <span class="php-quote">'root@localhost'</span>;
<a href="#89" id="89" class="l">  89: </a>
<a href="#90" id="90" class="l">  90: </a>    <span class="php-comment">/**
</span><a href="#91" id="91" class="l">  91: </a><span class="php-comment">     * Sets the From name of the message.
</span><a href="#92" id="92" class="l">  92: </a><span class="php-comment">     * @var string
</span><a href="#93" id="93" class="l">  93: </a><span class="php-comment">     */</span>
<a href="#94" id="94" class="l">  94: </a>    <span class="php-keyword1">public</span> <span class="php-var">$FromName</span> = <span class="php-quote">'Root User'</span>;
<a href="#95" id="95" class="l">  95: </a>
<a href="#96" id="96" class="l">  96: </a>    <span class="php-comment">/**
</span><a href="#97" id="97" class="l">  97: </a><span class="php-comment">     * Sets the Sender email (Return-Path) of the message.  If not empty,
</span><a href="#98" id="98" class="l">  98: </a><span class="php-comment">     * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
</span><a href="#99" id="99" class="l">  99: </a><span class="php-comment">     * @var string
</span><a href="#100" id="100" class="l"> 100: </a><span class="php-comment">     */</span>
<a href="#101" id="101" class="l"> 101: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Sender</span> = <span class="php-quote">''</span>;
<a href="#102" id="102" class="l"> 102: </a>
<a href="#103" id="103" class="l"> 103: </a>    <span class="php-comment">/**
</span><a href="#104" id="104" class="l"> 104: </a><span class="php-comment">     * Sets the Subject of the message.
</span><a href="#105" id="105" class="l"> 105: </a><span class="php-comment">     * @var string
</span><a href="#106" id="106" class="l"> 106: </a><span class="php-comment">     */</span>
<a href="#107" id="107" class="l"> 107: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Subject</span> = <span class="php-quote">''</span>;
<a href="#108" id="108" class="l"> 108: </a>
<a href="#109" id="109" class="l"> 109: </a>    <span class="php-comment">/**
</span><a href="#110" id="110" class="l"> 110: </a><span class="php-comment">     * Sets the Body of the message.  This can be either an HTML or text body.
</span><a href="#111" id="111" class="l"> 111: </a><span class="php-comment">     * If HTML then run IsHTML(TRUE).
</span><a href="#112" id="112" class="l"> 112: </a><span class="php-comment">     * @var string
</span><a href="#113" id="113" class="l"> 113: </a><span class="php-comment">     */</span>
<a href="#114" id="114" class="l"> 114: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Body</span> = <span class="php-quote">''</span>;
<a href="#115" id="115" class="l"> 115: </a>
<a href="#116" id="116" class="l"> 116: </a>    <span class="php-comment">/**
</span><a href="#117" id="117" class="l"> 117: </a><span class="php-comment">     * Sets the text-only body of the message.  This automatically sets the
</span><a href="#118" id="118" class="l"> 118: </a><span class="php-comment">     * email to multipart/alternative.  This body can be read by mail
</span><a href="#119" id="119" class="l"> 119: </a><span class="php-comment">     * clients that do not have HTML email capability such as mutt. Clients
</span><a href="#120" id="120" class="l"> 120: </a><span class="php-comment">     * that can read HTML will view the normal Body.
</span><a href="#121" id="121" class="l"> 121: </a><span class="php-comment">     * @var string
</span><a href="#122" id="122" class="l"> 122: </a><span class="php-comment">     */</span>
<a href="#123" id="123" class="l"> 123: </a>    <span class="php-keyword1">public</span> <span class="php-var">$AltBody</span> = <span class="php-quote">''</span>;
<a href="#124" id="124" class="l"> 124: </a>
<a href="#125" id="125" class="l"> 125: </a>    <span class="php-comment">/**
</span><a href="#126" id="126" class="l"> 126: </a><span class="php-comment">     * Sets word wrapping on the body of the message to a given number of
</span><a href="#127" id="127" class="l"> 127: </a><span class="php-comment">     * characters.
</span><a href="#128" id="128" class="l"> 128: </a><span class="php-comment">     * @var int
</span><a href="#129" id="129" class="l"> 129: </a><span class="php-comment">     */</span>
<a href="#130" id="130" class="l"> 130: </a>    <span class="php-keyword1">public</span> <span class="php-var">$WordWrap</span> = <span class="php-num">0</span>;
<a href="#131" id="131" class="l"> 131: </a>
<a href="#132" id="132" class="l"> 132: </a>    <span class="php-comment">/**
</span><a href="#133" id="133" class="l"> 133: </a><span class="php-comment">     * Method to send mail: (&quot;mail&quot;, &quot;sendmail&quot;, or &quot;smtp&quot;).
</span><a href="#134" id="134" class="l"> 134: </a><span class="php-comment">     * @var string
</span><a href="#135" id="135" class="l"> 135: </a><span class="php-comment">     */</span>
<a href="#136" id="136" class="l"> 136: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Mailer</span> = <span class="php-quote">'mail'</span>;
<a href="#137" id="137" class="l"> 137: </a>
<a href="#138" id="138" class="l"> 138: </a>    <span class="php-comment">/**
</span><a href="#139" id="139" class="l"> 139: </a><span class="php-comment">     * Sets the path of the sendmail program.
</span><a href="#140" id="140" class="l"> 140: </a><span class="php-comment">     * @var string
</span><a href="#141" id="141" class="l"> 141: </a><span class="php-comment">     */</span>
<a href="#142" id="142" class="l"> 142: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Sendmail</span> = <span class="php-quote">'/usr/sbin/sendmail'</span>;
<a href="#143" id="143" class="l"> 143: </a>
<a href="#144" id="144" class="l"> 144: </a>    <span class="php-comment">/**
</span><a href="#145" id="145" class="l"> 145: </a><span class="php-comment">     * Path to PHPMailer plugins.  Useful if the SMTP class
</span><a href="#146" id="146" class="l"> 146: </a><span class="php-comment">     * is in a different directory than the PHP include path.
</span><a href="#147" id="147" class="l"> 147: </a><span class="php-comment">     * @var string
</span><a href="#148" id="148" class="l"> 148: </a><span class="php-comment">     */</span>
<a href="#149" id="149" class="l"> 149: </a>    <span class="php-keyword1">public</span> <span class="php-var">$PluginDir</span> = <span class="php-quote">''</span>;
<a href="#150" id="150" class="l"> 150: </a>
<a href="#151" id="151" class="l"> 151: </a>    <span class="php-comment">/**
</span><a href="#152" id="152" class="l"> 152: </a><span class="php-comment">     * Sets the email address that a reading confirmation will be sent.
</span><a href="#153" id="153" class="l"> 153: </a><span class="php-comment">     * @var string
</span><a href="#154" id="154" class="l"> 154: </a><span class="php-comment">     */</span>
<a href="#155" id="155" class="l"> 155: </a>    <span class="php-keyword1">public</span> <span class="php-var">$ConfirmReadingTo</span> = <span class="php-quote">''</span>;
<a href="#156" id="156" class="l"> 156: </a>
<a href="#157" id="157" class="l"> 157: </a>    <span class="php-comment">/**
</span><a href="#158" id="158" class="l"> 158: </a><span class="php-comment">     * Sets the hostname to use in Message-Id and Received headers
</span><a href="#159" id="159" class="l"> 159: </a><span class="php-comment">     * and as default HELO string. If empty, the value returned
</span><a href="#160" id="160" class="l"> 160: </a><span class="php-comment">     * by SERVER_NAME is used or 'localhost.localdomain'.
</span><a href="#161" id="161" class="l"> 161: </a><span class="php-comment">     * @var string
</span><a href="#162" id="162" class="l"> 162: </a><span class="php-comment">     */</span>
<a href="#163" id="163" class="l"> 163: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Hostname</span> = <span class="php-quote">''</span>;
<a href="#164" id="164" class="l"> 164: </a>
<a href="#165" id="165" class="l"> 165: </a>    <span class="php-comment">/**
</span><a href="#166" id="166" class="l"> 166: </a><span class="php-comment">     * Sets the message ID to be used in the Message-Id header.
</span><a href="#167" id="167" class="l"> 167: </a><span class="php-comment">     * If empty, a unique id will be generated.
</span><a href="#168" id="168" class="l"> 168: </a><span class="php-comment">     * @var string
</span><a href="#169" id="169" class="l"> 169: </a><span class="php-comment">     */</span>
<a href="#170" id="170" class="l"> 170: </a>    <span class="php-keyword1">public</span> <span class="php-var">$MessageID</span> = <span class="php-quote">''</span>;
<a href="#171" id="171" class="l"> 171: </a>
<a href="#172" id="172" class="l"> 172: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#173" id="173" class="l"> 173: </a>    <span class="php-comment">// PROPERTIES FOR SMTP</span>
<a href="#174" id="174" class="l"> 174: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#175" id="175" class="l"> 175: </a>
<a href="#176" id="176" class="l"> 176: </a>    <span class="php-comment">/**
</span><a href="#177" id="177" class="l"> 177: </a><span class="php-comment">     * Sets the SMTP hosts.  All hosts must be separated by a
</span><a href="#178" id="178" class="l"> 178: </a><span class="php-comment">     * semicolon.  You can also specify a different port
</span><a href="#179" id="179" class="l"> 179: </a><span class="php-comment">     * for each host by using this format: [hostname:port]
</span><a href="#180" id="180" class="l"> 180: </a><span class="php-comment">     * (e.g. &quot;smtp1.example.com:25;smtp2.example.com&quot;).
</span><a href="#181" id="181" class="l"> 181: </a><span class="php-comment">     * Hosts will be tried in order.
</span><a href="#182" id="182" class="l"> 182: </a><span class="php-comment">     * @var string
</span><a href="#183" id="183" class="l"> 183: </a><span class="php-comment">     */</span>
<a href="#184" id="184" class="l"> 184: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Host</span> = <span class="php-quote">'localhost'</span>;
<a href="#185" id="185" class="l"> 185: </a>
<a href="#186" id="186" class="l"> 186: </a>    <span class="php-comment">/**
</span><a href="#187" id="187" class="l"> 187: </a><span class="php-comment">     * Sets the default SMTP server port.
</span><a href="#188" id="188" class="l"> 188: </a><span class="php-comment">     * @var int
</span><a href="#189" id="189" class="l"> 189: </a><span class="php-comment">     */</span>
<a href="#190" id="190" class="l"> 190: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Port</span> = <span class="php-num">25</span>;
<a href="#191" id="191" class="l"> 191: </a>
<a href="#192" id="192" class="l"> 192: </a>    <span class="php-comment">/**
</span><a href="#193" id="193" class="l"> 193: </a><span class="php-comment">     * Sets the SMTP HELO of the message (Default is $Hostname).
</span><a href="#194" id="194" class="l"> 194: </a><span class="php-comment">     * @var string
</span><a href="#195" id="195" class="l"> 195: </a><span class="php-comment">     */</span>
<a href="#196" id="196" class="l"> 196: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Helo</span> = <span class="php-quote">''</span>;
<a href="#197" id="197" class="l"> 197: </a>
<a href="#198" id="198" class="l"> 198: </a>    <span class="php-comment">/**
</span><a href="#199" id="199" class="l"> 199: </a><span class="php-comment">     * Sets connection prefix.
</span><a href="#200" id="200" class="l"> 200: </a><span class="php-comment">     * Options are &quot;&quot;, &quot;ssl&quot; or &quot;tls&quot;
</span><a href="#201" id="201" class="l"> 201: </a><span class="php-comment">     * @var string
</span><a href="#202" id="202" class="l"> 202: </a><span class="php-comment">     */</span>
<a href="#203" id="203" class="l"> 203: </a>    <span class="php-keyword1">public</span> <span class="php-var">$SMTPSecure</span> = <span class="php-quote">''</span>;
<a href="#204" id="204" class="l"> 204: </a>
<a href="#205" id="205" class="l"> 205: </a>    <span class="php-comment">/**
</span><a href="#206" id="206" class="l"> 206: </a><span class="php-comment">     * Sets SMTP authentication. Utilizes the Username and Password variables.
</span><a href="#207" id="207" class="l"> 207: </a><span class="php-comment">     * @var bool
</span><a href="#208" id="208" class="l"> 208: </a><span class="php-comment">     */</span>
<a href="#209" id="209" class="l"> 209: </a>    <span class="php-keyword1">public</span> <span class="php-var">$SMTPAuth</span> = <span class="php-keyword1">FALSE</span>;
<a href="#210" id="210" class="l"> 210: </a>
<a href="#211" id="211" class="l"> 211: </a>    <span class="php-comment">/**
</span><a href="#212" id="212" class="l"> 212: </a><span class="php-comment">     * Sets SMTP username.
</span><a href="#213" id="213" class="l"> 213: </a><span class="php-comment">     * @var string
</span><a href="#214" id="214" class="l"> 214: </a><span class="php-comment">     */</span>
<a href="#215" id="215" class="l"> 215: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Username</span> = <span class="php-quote">''</span>;
<a href="#216" id="216" class="l"> 216: </a>
<a href="#217" id="217" class="l"> 217: </a>    <span class="php-comment">/**
</span><a href="#218" id="218" class="l"> 218: </a><span class="php-comment">     * Sets SMTP password.
</span><a href="#219" id="219" class="l"> 219: </a><span class="php-comment">     * @var string
</span><a href="#220" id="220" class="l"> 220: </a><span class="php-comment">     */</span>
<a href="#221" id="221" class="l"> 221: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Password</span> = <span class="php-quote">''</span>;
<a href="#222" id="222" class="l"> 222: </a>
<a href="#223" id="223" class="l"> 223: </a>    <span class="php-comment">/**
</span><a href="#224" id="224" class="l"> 224: </a><span class="php-comment">     * Sets the SMTP server timeout in seconds.
</span><a href="#225" id="225" class="l"> 225: </a><span class="php-comment">     * This function will not work with the win32 version.
</span><a href="#226" id="226" class="l"> 226: </a><span class="php-comment">     * @var int
</span><a href="#227" id="227" class="l"> 227: </a><span class="php-comment">     */</span>
<a href="#228" id="228" class="l"> 228: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Timeout</span> = <span class="php-num">10</span>;
<a href="#229" id="229" class="l"> 229: </a>
<a href="#230" id="230" class="l"> 230: </a>    <span class="php-comment">/**
</span><a href="#231" id="231" class="l"> 231: </a><span class="php-comment">     * Sets SMTP class debugging on or off.
</span><a href="#232" id="232" class="l"> 232: </a><span class="php-comment">     * @var bool
</span><a href="#233" id="233" class="l"> 233: </a><span class="php-comment">     */</span>
<a href="#234" id="234" class="l"> 234: </a>    <span class="php-keyword1">public</span> <span class="php-var">$SMTPDebug</span> = <span class="php-keyword1">FALSE</span>;
<a href="#235" id="235" class="l"> 235: </a>
<a href="#236" id="236" class="l"> 236: </a>    <span class="php-comment">/**
</span><a href="#237" id="237" class="l"> 237: </a><span class="php-comment">     * Prevents the SMTP connection from being closed after each mail
</span><a href="#238" id="238" class="l"> 238: </a><span class="php-comment">     * sending.  If this is set to TRUE then to close the connection
</span><a href="#239" id="239" class="l"> 239: </a><span class="php-comment">     * requires an explicit call to SmtpClose().
</span><a href="#240" id="240" class="l"> 240: </a><span class="php-comment">     * @var bool
</span><a href="#241" id="241" class="l"> 241: </a><span class="php-comment">     */</span>
<a href="#242" id="242" class="l"> 242: </a>    <span class="php-keyword1">public</span> <span class="php-var">$SMTPKeepAlive</span> = <span class="php-keyword1">FALSE</span>;
<a href="#243" id="243" class="l"> 243: </a>
<a href="#244" id="244" class="l"> 244: </a>    <span class="php-comment">/**
</span><a href="#245" id="245" class="l"> 245: </a><span class="php-comment">     * Provides the ability to have the TO field process individual
</span><a href="#246" id="246" class="l"> 246: </a><span class="php-comment">     * emails, instead of sending to entire TO addresses
</span><a href="#247" id="247" class="l"> 247: </a><span class="php-comment">     * @var bool
</span><a href="#248" id="248" class="l"> 248: </a><span class="php-comment">     */</span>
<a href="#249" id="249" class="l"> 249: </a>    <span class="php-keyword1">public</span> <span class="php-var">$SingleTo</span> = <span class="php-keyword1">FALSE</span>;
<a href="#250" id="250" class="l"> 250: </a>
<a href="#251" id="251" class="l"> 251: </a>    <span class="php-comment">/**
</span><a href="#252" id="252" class="l"> 252: </a><span class="php-comment">     * If SingleTo is TRUE, this provides the array to hold the email addresses
</span><a href="#253" id="253" class="l"> 253: </a><span class="php-comment">     * @var bool
</span><a href="#254" id="254" class="l"> 254: </a><span class="php-comment">     */</span>
<a href="#255" id="255" class="l"> 255: </a>    <span class="php-keyword1">public</span> <span class="php-var">$SingleToArray</span> = <span class="php-keyword1">array</span>();
<a href="#256" id="256" class="l"> 256: </a>
<a href="#257" id="257" class="l"> 257: </a>    <span class="php-comment">/**
</span><a href="#258" id="258" class="l"> 258: </a><span class="php-comment">     * Provides the ability to change the line ending
</span><a href="#259" id="259" class="l"> 259: </a><span class="php-comment">     * @var string
</span><a href="#260" id="260" class="l"> 260: </a><span class="php-comment">     */</span>
<a href="#261" id="261" class="l"> 261: </a>    <span class="php-keyword1">public</span> <span class="php-var">$LE</span> = <span class="php-quote">&quot;\n&quot;</span>;
<a href="#262" id="262" class="l"> 262: </a>
<a href="#263" id="263" class="l"> 263: </a>    <span class="php-comment">/**
</span><a href="#264" id="264" class="l"> 264: </a><span class="php-comment">     * Used with DKIM DNS Resource Record
</span><a href="#265" id="265" class="l"> 265: </a><span class="php-comment">     * @var string
</span><a href="#266" id="266" class="l"> 266: </a><span class="php-comment">     */</span>
<a href="#267" id="267" class="l"> 267: </a>    <span class="php-keyword1">public</span> <span class="php-var">$DKIM_selector</span> = <span class="php-quote">'phpmailer'</span>;
<a href="#268" id="268" class="l"> 268: </a>
<a href="#269" id="269" class="l"> 269: </a>    <span class="php-comment">/**
</span><a href="#270" id="270" class="l"> 270: </a><span class="php-comment">     * Used with DKIM DNS Resource Record
</span><a href="#271" id="271" class="l"> 271: </a><span class="php-comment">     * optional, in format of email address 'you@yourdomain.com'
</span><a href="#272" id="272" class="l"> 272: </a><span class="php-comment">     * @var string
</span><a href="#273" id="273" class="l"> 273: </a><span class="php-comment">     */</span>
<a href="#274" id="274" class="l"> 274: </a>    <span class="php-keyword1">public</span> <span class="php-var">$DKIM_identity</span> = <span class="php-quote">''</span>;
<a href="#275" id="275" class="l"> 275: </a>
<a href="#276" id="276" class="l"> 276: </a>    <span class="php-comment">/**
</span><a href="#277" id="277" class="l"> 277: </a><span class="php-comment">     * Used with DKIM DNS Resource Record
</span><a href="#278" id="278" class="l"> 278: </a><span class="php-comment">     * optional, in format of email address 'you@yourdomain.com'
</span><a href="#279" id="279" class="l"> 279: </a><span class="php-comment">     * @var string
</span><a href="#280" id="280" class="l"> 280: </a><span class="php-comment">     */</span>
<a href="#281" id="281" class="l"> 281: </a>    <span class="php-keyword1">public</span> <span class="php-var">$DKIM_domain</span> = <span class="php-quote">''</span>;
<a href="#282" id="282" class="l"> 282: </a>
<a href="#283" id="283" class="l"> 283: </a>    <span class="php-comment">/**
</span><a href="#284" id="284" class="l"> 284: </a><span class="php-comment">     * Used with DKIM DNS Resource Record
</span><a href="#285" id="285" class="l"> 285: </a><span class="php-comment">     * optional, in format of email address 'you@yourdomain.com'
</span><a href="#286" id="286" class="l"> 286: </a><span class="php-comment">     * @var string
</span><a href="#287" id="287" class="l"> 287: </a><span class="php-comment">     */</span>
<a href="#288" id="288" class="l"> 288: </a>    <span class="php-keyword1">public</span> <span class="php-var">$DKIM_private</span> = <span class="php-quote">''</span>;
<a href="#289" id="289" class="l"> 289: </a>
<a href="#290" id="290" class="l"> 290: </a>    <span class="php-comment">/**
</span><a href="#291" id="291" class="l"> 291: </a><span class="php-comment">     * Callback Action function name
</span><a href="#292" id="292" class="l"> 292: </a><span class="php-comment">     * the function that handles the result of the send email action. Parameters:
</span><a href="#293" id="293" class="l"> 293: </a><span class="php-comment">     *   bool    $result        result of the send action
</span><a href="#294" id="294" class="l"> 294: </a><span class="php-comment">     *   string  $to            email address of the recipient
</span><a href="#295" id="295" class="l"> 295: </a><span class="php-comment">     *   string  $cc            cc email addresses
</span><a href="#296" id="296" class="l"> 296: </a><span class="php-comment">     *   string  $bcc           bcc email addresses
</span><a href="#297" id="297" class="l"> 297: </a><span class="php-comment">     *   string  $subject       the subject
</span><a href="#298" id="298" class="l"> 298: </a><span class="php-comment">     *   string  $body          the email body
</span><a href="#299" id="299" class="l"> 299: </a><span class="php-comment">     * @var string
</span><a href="#300" id="300" class="l"> 300: </a><span class="php-comment">     */</span>
<a href="#301" id="301" class="l"> 301: </a>    <span class="php-keyword1">public</span> <span class="php-var">$action_function</span> = <span class="php-quote">''</span>; <span class="php-comment">//'callbackAction';</span>
<a href="#302" id="302" class="l"> 302: </a>
<a href="#303" id="303" class="l"> 303: </a>    <span class="php-comment">/**
</span><a href="#304" id="304" class="l"> 304: </a><span class="php-comment">     * Sets the PHPMailer Version number
</span><a href="#305" id="305" class="l"> 305: </a><span class="php-comment">     * @var string
</span><a href="#306" id="306" class="l"> 306: </a><span class="php-comment">     */</span>
<a href="#307" id="307" class="l"> 307: </a>    <span class="php-keyword1">public</span> <span class="php-var">$Version</span> = <span class="php-quote">'5.1'</span>;
<a href="#308" id="308" class="l"> 308: </a>
<a href="#309" id="309" class="l"> 309: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#310" id="310" class="l"> 310: </a>    <span class="php-comment">// PROPERTIES, PRIVATE AND PROTECTED</span>
<a href="#311" id="311" class="l"> 311: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#312" id="312" class="l"> 312: </a>
<a href="#313" id="313" class="l"> 313: </a>    <span class="php-keyword1">private</span> <span class="php-var">$smtp</span> = <span class="php-keyword1">NULL</span>;
<a href="#314" id="314" class="l"> 314: </a>    <span class="php-keyword1">private</span> <span class="php-var">$to</span> = <span class="php-keyword1">array</span>();
<a href="#315" id="315" class="l"> 315: </a>    <span class="php-keyword1">private</span> <span class="php-var">$cc</span> = <span class="php-keyword1">array</span>();
<a href="#316" id="316" class="l"> 316: </a>    <span class="php-keyword1">private</span> <span class="php-var">$bcc</span> = <span class="php-keyword1">array</span>();
<a href="#317" id="317" class="l"> 317: </a>    <span class="php-keyword1">private</span> <span class="php-var">$ReplyTo</span> = <span class="php-keyword1">array</span>();
<a href="#318" id="318" class="l"> 318: </a>    <span class="php-keyword1">private</span> <span class="php-var">$all_recipients</span> = <span class="php-keyword1">array</span>();
<a href="#319" id="319" class="l"> 319: </a>    <span class="php-keyword1">private</span> <span class="php-var">$attachment</span> = <span class="php-keyword1">array</span>();
<a href="#320" id="320" class="l"> 320: </a>    <span class="php-keyword1">private</span> <span class="php-var">$CustomHeader</span> = <span class="php-keyword1">array</span>();
<a href="#321" id="321" class="l"> 321: </a>    <span class="php-keyword1">private</span> <span class="php-var">$message_type</span> = <span class="php-quote">''</span>;
<a href="#322" id="322" class="l"> 322: </a>    <span class="php-keyword1">private</span> <span class="php-var">$boundary</span> = <span class="php-keyword1">array</span>();
<a href="#323" id="323" class="l"> 323: </a>    <span class="php-keyword1">protected</span> <span class="php-var">$language</span> = <span class="php-keyword1">array</span>();
<a href="#324" id="324" class="l"> 324: </a>    <span class="php-keyword1">private</span> <span class="php-var">$error_count</span> = <span class="php-num">0</span>;
<a href="#325" id="325" class="l"> 325: </a>    <span class="php-keyword1">private</span> <span class="php-var">$sign_cert_file</span> = <span class="php-quote">&quot;&quot;</span>;
<a href="#326" id="326" class="l"> 326: </a>    <span class="php-keyword1">private</span> <span class="php-var">$sign_key_file</span> = <span class="php-quote">&quot;&quot;</span>;
<a href="#327" id="327" class="l"> 327: </a>    <span class="php-keyword1">private</span> <span class="php-var">$sign_key_pass</span> = <span class="php-quote">&quot;&quot;</span>;
<a href="#328" id="328" class="l"> 328: </a>    <span class="php-keyword1">private</span> <span class="php-var">$exceptions</span> = <span class="php-keyword1">FALSE</span>;
<a href="#329" id="329" class="l"> 329: </a>
<a href="#330" id="330" class="l"> 330: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#331" id="331" class="l"> 331: </a>    <span class="php-comment">// CONSTANTS</span>
<a href="#332" id="332" class="l"> 332: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#333" id="333" class="l"> 333: </a>
<a href="#334" id="334" class="l"> 334: </a>    <span class="php-keyword1">const</span> STOP_MESSAGE = <span class="php-num">0</span>; <span class="php-comment">// message only, continue processing</span>
<a href="#335" id="335" class="l"> 335: </a>    <span class="php-keyword1">const</span> STOP_CONTINUE = <span class="php-num">1</span>; <span class="php-comment">// message?, likely ok to continue processing</span>
<a href="#336" id="336" class="l"> 336: </a>    <span class="php-keyword1">const</span> STOP_CRITICAL = <span class="php-num">2</span>; <span class="php-comment">// message, plus full stop, critical error reached</span>
<a href="#337" id="337" class="l"> 337: </a>
<a href="#338" id="338" class="l"> 338: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#339" id="339" class="l"> 339: </a>    <span class="php-comment">// METHODS, VARIABLES</span>
<a href="#340" id="340" class="l"> 340: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#341" id="341" class="l"> 341: </a>
<a href="#342" id="342" class="l"> 342: </a>    <span class="php-comment">/**
</span><a href="#343" id="343" class="l"> 343: </a><span class="php-comment">     * Constructor
</span><a href="#344" id="344" class="l"> 344: </a><span class="php-comment">     * @param boolean $exceptions Should we throw external exceptions?
</span><a href="#345" id="345" class="l"> 345: </a><span class="php-comment">     */</span>
<a href="#346" id="346" class="l"> 346: </a>
<a href="#347" id="347" class="l"> 347: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> __construct(<span class="php-var">$exceptions</span> = <span class="php-keyword1">FALSE</span>)
<a href="#348" id="348" class="l"> 348: </a>    {
<a href="#349" id="349" class="l"> 349: </a>        <span class="php-var">$this</span>-&gt;exceptions = (<span class="php-var">$exceptions</span> == <span class="php-keyword1">TRUE</span>);
<a href="#350" id="350" class="l"> 350: </a>    }
<a href="#351" id="351" class="l"> 351: </a>
<a href="#352" id="352" class="l"> 352: </a>    <span class="php-comment">/**
</span><a href="#353" id="353" class="l"> 353: </a><span class="php-comment">     * Sets message type to HTML.
</span><a href="#354" id="354" class="l"> 354: </a><span class="php-comment">     * @param bool $ishtml
</span><a href="#355" id="355" class="l"> 355: </a><span class="php-comment">     * @return void
</span><a href="#356" id="356" class="l"> 356: </a><span class="php-comment">     */</span>
<a href="#357" id="357" class="l"> 357: </a>
<a href="#358" id="358" class="l"> 358: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> IsHTML(<span class="php-var">$ishtml</span> = <span class="php-keyword1">TRUE</span>)
<a href="#359" id="359" class="l"> 359: </a>    {
<a href="#360" id="360" class="l"> 360: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$ishtml</span>) {
<a href="#361" id="361" class="l"> 361: </a>            <span class="php-var">$this</span>-&gt;ContentType = <span class="php-quote">'text/html'</span>;
<a href="#362" id="362" class="l"> 362: </a>        } <span class="php-keyword1">else</span> {
<a href="#363" id="363" class="l"> 363: </a>            <span class="php-var">$this</span>-&gt;ContentType = <span class="php-quote">'text/plain'</span>;
<a href="#364" id="364" class="l"> 364: </a>        }
<a href="#365" id="365" class="l"> 365: </a>    }
<a href="#366" id="366" class="l"> 366: </a>
<a href="#367" id="367" class="l"> 367: </a>    <span class="php-comment">/**
</span><a href="#368" id="368" class="l"> 368: </a><span class="php-comment">     * Sets Mailer to send message using SMTP.
</span><a href="#369" id="369" class="l"> 369: </a><span class="php-comment">     * @return void
</span><a href="#370" id="370" class="l"> 370: </a><span class="php-comment">     */</span>
<a href="#371" id="371" class="l"> 371: </a>
<a href="#372" id="372" class="l"> 372: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> IsSMTP()
<a href="#373" id="373" class="l"> 373: </a>    {
<a href="#374" id="374" class="l"> 374: </a>        <span class="php-var">$this</span>-&gt;Mailer = <span class="php-quote">'smtp'</span>;
<a href="#375" id="375" class="l"> 375: </a>    }
<a href="#376" id="376" class="l"> 376: </a>
<a href="#377" id="377" class="l"> 377: </a>    <span class="php-comment">/**
</span><a href="#378" id="378" class="l"> 378: </a><span class="php-comment">     * Sets Mailer to send message using PHP mail() function.
</span><a href="#379" id="379" class="l"> 379: </a><span class="php-comment">     * @return void
</span><a href="#380" id="380" class="l"> 380: </a><span class="php-comment">     */</span>
<a href="#381" id="381" class="l"> 381: </a>
<a href="#382" id="382" class="l"> 382: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> IsMail()
<a href="#383" id="383" class="l"> 383: </a>    {
<a href="#384" id="384" class="l"> 384: </a>        <span class="php-var">$this</span>-&gt;Mailer = <span class="php-quote">'mail'</span>;
<a href="#385" id="385" class="l"> 385: </a>    }
<a href="#386" id="386" class="l"> 386: </a>
<a href="#387" id="387" class="l"> 387: </a>    <span class="php-comment">/**
</span><a href="#388" id="388" class="l"> 388: </a><span class="php-comment">     * Sets Mailer to send message using the $Sendmail program.
</span><a href="#389" id="389" class="l"> 389: </a><span class="php-comment">     * @return void
</span><a href="#390" id="390" class="l"> 390: </a><span class="php-comment">     */</span>
<a href="#391" id="391" class="l"> 391: </a>
<a href="#392" id="392" class="l"> 392: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> IsSendmail()
<a href="#393" id="393" class="l"> 393: </a>    {
<a href="#394" id="394" class="l"> 394: </a>        <span class="php-keyword1">if</span> (!<span class="php-keyword2">stristr</span>(<span class="php-keyword2">ini_get</span>(<span class="php-quote">'sendmail_path'</span>), <span class="php-quote">'sendmail'</span>)) {
<a href="#395" id="395" class="l"> 395: </a>            <span class="php-var">$this</span>-&gt;Sendmail = <span class="php-quote">'/var/qmail/bin/sendmail'</span>;
<a href="#396" id="396" class="l"> 396: </a>        }
<a href="#397" id="397" class="l"> 397: </a>        <span class="php-var">$this</span>-&gt;Mailer = <span class="php-quote">'sendmail'</span>;
<a href="#398" id="398" class="l"> 398: </a>    }
<a href="#399" id="399" class="l"> 399: </a>
<a href="#400" id="400" class="l"> 400: </a>    <span class="php-comment">/**
</span><a href="#401" id="401" class="l"> 401: </a><span class="php-comment">     * Sets Mailer to send message using the qmail MTA.
</span><a href="#402" id="402" class="l"> 402: </a><span class="php-comment">     * @return void
</span><a href="#403" id="403" class="l"> 403: </a><span class="php-comment">     */</span>
<a href="#404" id="404" class="l"> 404: </a>
<a href="#405" id="405" class="l"> 405: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> IsQmail()
<a href="#406" id="406" class="l"> 406: </a>    {
<a href="#407" id="407" class="l"> 407: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">stristr</span>(<span class="php-keyword2">ini_get</span>(<span class="php-quote">'sendmail_path'</span>), <span class="php-quote">'qmail'</span>)) {
<a href="#408" id="408" class="l"> 408: </a>            <span class="php-var">$this</span>-&gt;Sendmail = <span class="php-quote">'/var/qmail/bin/sendmail'</span>;
<a href="#409" id="409" class="l"> 409: </a>        }
<a href="#410" id="410" class="l"> 410: </a>        <span class="php-var">$this</span>-&gt;Mailer = <span class="php-quote">'sendmail'</span>;
<a href="#411" id="411" class="l"> 411: </a>    }
<a href="#412" id="412" class="l"> 412: </a>
<a href="#413" id="413" class="l"> 413: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#414" id="414" class="l"> 414: </a>    <span class="php-comment">// METHODS, RECIPIENTS</span>
<a href="#415" id="415" class="l"> 415: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#416" id="416" class="l"> 416: </a>
<a href="#417" id="417" class="l"> 417: </a>    <span class="php-comment">/**
</span><a href="#418" id="418" class="l"> 418: </a><span class="php-comment">     * Adds a &quot;To&quot; address.
</span><a href="#419" id="419" class="l"> 419: </a><span class="php-comment">     * @param string $address
</span><a href="#420" id="420" class="l"> 420: </a><span class="php-comment">     * @param string $name
</span><a href="#421" id="421" class="l"> 421: </a><span class="php-comment">     * @return boolean TRUE on success, FALSE if address already used
</span><a href="#422" id="422" class="l"> 422: </a><span class="php-comment">     */</span>
<a href="#423" id="423" class="l"> 423: </a>
<a href="#424" id="424" class="l"> 424: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddAddress(<span class="php-var">$address</span>, <span class="php-var">$name</span> = <span class="php-quote">''</span>)
<a href="#425" id="425" class="l"> 425: </a>    {
<a href="#426" id="426" class="l"> 426: </a>        <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;AddAnAddress(<span class="php-quote">'to'</span>, <span class="php-var">$address</span>, <span class="php-var">$name</span>);
<a href="#427" id="427" class="l"> 427: </a>    }
<a href="#428" id="428" class="l"> 428: </a>
<a href="#429" id="429" class="l"> 429: </a>    <span class="php-comment">/**
</span><a href="#430" id="430" class="l"> 430: </a><span class="php-comment">     * Adds a &quot;Cc&quot; address.
</span><a href="#431" id="431" class="l"> 431: </a><span class="php-comment">     * Note: this function works with the SMTP mailer on win32, not with the &quot;mail&quot; mailer.
</span><a href="#432" id="432" class="l"> 432: </a><span class="php-comment">     * @param string $address
</span><a href="#433" id="433" class="l"> 433: </a><span class="php-comment">     * @param string $name
</span><a href="#434" id="434" class="l"> 434: </a><span class="php-comment">     * @return boolean TRUE on success, FALSE if address already used
</span><a href="#435" id="435" class="l"> 435: </a><span class="php-comment">     */</span>
<a href="#436" id="436" class="l"> 436: </a>
<a href="#437" id="437" class="l"> 437: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddCC(<span class="php-var">$address</span>, <span class="php-var">$name</span> = <span class="php-quote">''</span>)
<a href="#438" id="438" class="l"> 438: </a>    {
<a href="#439" id="439" class="l"> 439: </a>        <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;AddAnAddress(<span class="php-quote">'cc'</span>, <span class="php-var">$address</span>, <span class="php-var">$name</span>);
<a href="#440" id="440" class="l"> 440: </a>    }
<a href="#441" id="441" class="l"> 441: </a>
<a href="#442" id="442" class="l"> 442: </a>    <span class="php-comment">/**
</span><a href="#443" id="443" class="l"> 443: </a><span class="php-comment">     * Adds a &quot;Bcc&quot; address.
</span><a href="#444" id="444" class="l"> 444: </a><span class="php-comment">     * Note: this function works with the SMTP mailer on win32, not with the &quot;mail&quot; mailer.
</span><a href="#445" id="445" class="l"> 445: </a><span class="php-comment">     * @param string $address
</span><a href="#446" id="446" class="l"> 446: </a><span class="php-comment">     * @param string $name
</span><a href="#447" id="447" class="l"> 447: </a><span class="php-comment">     * @return boolean TRUE on success, FALSE if address already used
</span><a href="#448" id="448" class="l"> 448: </a><span class="php-comment">     */</span>
<a href="#449" id="449" class="l"> 449: </a>
<a href="#450" id="450" class="l"> 450: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddBCC(<span class="php-var">$address</span>, <span class="php-var">$name</span> = <span class="php-quote">''</span>)
<a href="#451" id="451" class="l"> 451: </a>    {
<a href="#452" id="452" class="l"> 452: </a>        <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;AddAnAddress(<span class="php-quote">'bcc'</span>, <span class="php-var">$address</span>, <span class="php-var">$name</span>);
<a href="#453" id="453" class="l"> 453: </a>    }
<a href="#454" id="454" class="l"> 454: </a>
<a href="#455" id="455" class="l"> 455: </a>    <span class="php-comment">/**
</span><a href="#456" id="456" class="l"> 456: </a><span class="php-comment">     * Adds a &quot;Reply-to&quot; address.
</span><a href="#457" id="457" class="l"> 457: </a><span class="php-comment">     * @param string $address
</span><a href="#458" id="458" class="l"> 458: </a><span class="php-comment">     * @param string $name
</span><a href="#459" id="459" class="l"> 459: </a><span class="php-comment">     * @return boolean
</span><a href="#460" id="460" class="l"> 460: </a><span class="php-comment">     */</span>
<a href="#461" id="461" class="l"> 461: </a>
<a href="#462" id="462" class="l"> 462: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddReplyTo(<span class="php-var">$address</span>, <span class="php-var">$name</span> = <span class="php-quote">''</span>)
<a href="#463" id="463" class="l"> 463: </a>    {
<a href="#464" id="464" class="l"> 464: </a>        <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;AddAnAddress(<span class="php-quote">'ReplyTo'</span>, <span class="php-var">$address</span>, <span class="php-var">$name</span>);
<a href="#465" id="465" class="l"> 465: </a>    }
<a href="#466" id="466" class="l"> 466: </a>
<a href="#467" id="467" class="l"> 467: </a>    <span class="php-comment">/**
</span><a href="#468" id="468" class="l"> 468: </a><span class="php-comment">     * Adds an address to one of the recipient arrays
</span><a href="#469" id="469" class="l"> 469: </a><span class="php-comment">     * Addresses that have been added already return FALSE, but do not throw exceptions
</span><a href="#470" id="470" class="l"> 470: </a><span class="php-comment">     * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
</span><a href="#471" id="471" class="l"> 471: </a><span class="php-comment">     * @param string $address The email address to send to
</span><a href="#472" id="472" class="l"> 472: </a><span class="php-comment">     * @param string $name
</span><a href="#473" id="473" class="l"> 473: </a><span class="php-comment">     * @return boolean TRUE on success, FALSE if address already used or invalid in some way
</span><a href="#474" id="474" class="l"> 474: </a><span class="php-comment">     * @access private
</span><a href="#475" id="475" class="l"> 475: </a><span class="php-comment">     */</span>
<a href="#476" id="476" class="l"> 476: </a>
<a href="#477" id="477" class="l"> 477: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> AddAnAddress(<span class="php-var">$kind</span>, <span class="php-var">$address</span>, <span class="php-var">$name</span> = <span class="php-quote">''</span>)
<a href="#478" id="478" class="l"> 478: </a>    {
<a href="#479" id="479" class="l"> 479: </a>        <span class="php-keyword1">if</span> (!<span class="php-keyword2">preg_match</span>(<span class="php-quote">'/^(to|cc|bcc|ReplyTo)$/'</span>, <span class="php-var">$kind</span>)) {
<a href="#480" id="480" class="l"> 480: </a>            <span class="php-keyword1">echo</span> <span class="php-quote">'Invalid recipient array: '</span> . kind;
<a href="#481" id="481" class="l"> 481: </a>            <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#482" id="482" class="l"> 482: </a>        }
<a href="#483" id="483" class="l"> 483: </a>        <span class="php-var">$address</span> = <span class="php-keyword2">trim</span>(<span class="php-var">$address</span>);
<a href="#484" id="484" class="l"> 484: </a>        <span class="php-var">$name</span> = <span class="php-keyword2">trim</span>(<span class="php-keyword2">preg_replace</span>(<span class="php-quote">'/[\r\n]+/'</span>, <span class="php-quote">''</span>, <span class="php-var">$name</span>)); <span class="php-comment">//Strip breaks and trim</span>
<a href="#485" id="485" class="l"> 485: </a>        <span class="php-keyword1">if</span> (!self::ValidateAddress(<span class="php-var">$address</span>)) {
<a href="#486" id="486" class="l"> 486: </a>            <span class="php-var">$this</span>-&gt;SetError(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'invalid_address'</span>) . <span class="php-quote">': '</span> . <span class="php-var">$address</span>);
<a href="#487" id="487" class="l"> 487: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;exceptions) {
<a href="#488" id="488" class="l"> 488: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#489" id="489" class="l"> 489: </a>                        <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'invalid_address'</span>) . <span class="php-quote">': '</span> . <span class="php-var">$address</span>);
<a href="#490" id="490" class="l"> 490: </a>            }
<a href="#491" id="491" class="l"> 491: </a>            <span class="php-keyword1">echo</span> <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'invalid_address'</span>) . <span class="php-quote">': '</span> . <span class="php-var">$address</span>;
<a href="#492" id="492" class="l"> 492: </a>            <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#493" id="493" class="l"> 493: </a>        }
<a href="#494" id="494" class="l"> 494: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$kind</span> != <span class="php-quote">'ReplyTo'</span>) {
<a href="#495" id="495" class="l"> 495: </a>            <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>-&gt;all_recipients[<span class="php-keyword2">strtolower</span>(<span class="php-var">$address</span>)])) {
<a href="#496" id="496" class="l"> 496: </a>                <span class="php-keyword2">array_push</span>(<span class="php-var">$this</span>-&gt;<span class="php-var">$kind</span>,
<a href="#497" id="497" class="l"> 497: </a>                        <span class="php-keyword1">array</span>(
<a href="#498" id="498" class="l"> 498: </a>                                <span class="php-var">$address</span>,
<a href="#499" id="499" class="l"> 499: </a>                                <span class="php-var">$name</span>
<a href="#500" id="500" class="l"> 500: </a>                        ));
<a href="#501" id="501" class="l"> 501: </a>                <span class="php-var">$this</span>-&gt;all_recipients[<span class="php-keyword2">strtolower</span>(<span class="php-var">$address</span>)] = <span class="php-keyword1">TRUE</span>;
<a href="#502" id="502" class="l"> 502: </a>                <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#503" id="503" class="l"> 503: </a>            }
<a href="#504" id="504" class="l"> 504: </a>        } <span class="php-keyword1">else</span> {
<a href="#505" id="505" class="l"> 505: </a>            <span class="php-keyword1">if</span> (!<span class="php-keyword2">array_key_exists</span>(<span class="php-keyword2">strtolower</span>(<span class="php-var">$address</span>), <span class="php-var">$this</span>-&gt;ReplyTo)) {
<a href="#506" id="506" class="l"> 506: </a>                <span class="php-var">$this</span>-&gt;ReplyTo[<span class="php-keyword2">strtolower</span>(<span class="php-var">$address</span>)] = <span class="php-keyword1">array</span>(
<a href="#507" id="507" class="l"> 507: </a>                        <span class="php-var">$address</span>,
<a href="#508" id="508" class="l"> 508: </a>                        <span class="php-var">$name</span>
<a href="#509" id="509" class="l"> 509: </a>                );
<a href="#510" id="510" class="l"> 510: </a>                <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#511" id="511" class="l"> 511: </a>            }
<a href="#512" id="512" class="l"> 512: </a>        }
<a href="#513" id="513" class="l"> 513: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#514" id="514" class="l"> 514: </a>    }
<a href="#515" id="515" class="l"> 515: </a>
<a href="#516" id="516" class="l"> 516: </a>    <span class="php-comment">/**
</span><a href="#517" id="517" class="l"> 517: </a><span class="php-comment">     * Set the From and FromName properties
</span><a href="#518" id="518" class="l"> 518: </a><span class="php-comment">     * @param string $address
</span><a href="#519" id="519" class="l"> 519: </a><span class="php-comment">     * @param string $name
</span><a href="#520" id="520" class="l"> 520: </a><span class="php-comment">     * @return boolean
</span><a href="#521" id="521" class="l"> 521: </a><span class="php-comment">     */</span>
<a href="#522" id="522" class="l"> 522: </a>
<a href="#523" id="523" class="l"> 523: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> SetFrom(<span class="php-var">$address</span>, <span class="php-var">$name</span> = <span class="php-quote">''</span>, <span class="php-var">$auto</span> = <span class="php-num">1</span>)
<a href="#524" id="524" class="l"> 524: </a>    {
<a href="#525" id="525" class="l"> 525: </a>        <span class="php-var">$address</span> = <span class="php-keyword2">trim</span>(<span class="php-var">$address</span>);
<a href="#526" id="526" class="l"> 526: </a>        <span class="php-var">$name</span> = <span class="php-keyword2">trim</span>(<span class="php-keyword2">preg_replace</span>(<span class="php-quote">'/[\r\n]+/'</span>, <span class="php-quote">''</span>, <span class="php-var">$name</span>)); <span class="php-comment">//Strip breaks and trim</span>
<a href="#527" id="527" class="l"> 527: </a>        <span class="php-keyword1">if</span> (!self::ValidateAddress(<span class="php-var">$address</span>)) {
<a href="#528" id="528" class="l"> 528: </a>            <span class="php-var">$this</span>-&gt;SetError(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'invalid_address'</span>) . <span class="php-quote">': '</span> . <span class="php-var">$address</span>);
<a href="#529" id="529" class="l"> 529: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;exceptions) {
<a href="#530" id="530" class="l"> 530: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#531" id="531" class="l"> 531: </a>                        <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'invalid_address'</span>) . <span class="php-quote">': '</span> . <span class="php-var">$address</span>);
<a href="#532" id="532" class="l"> 532: </a>            }
<a href="#533" id="533" class="l"> 533: </a>            <span class="php-keyword1">echo</span> <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'invalid_address'</span>) . <span class="php-quote">': '</span> . <span class="php-var">$address</span>;
<a href="#534" id="534" class="l"> 534: </a>            <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#535" id="535" class="l"> 535: </a>        }
<a href="#536" id="536" class="l"> 536: </a>        <span class="php-var">$this</span>-&gt;From = <span class="php-var">$address</span>;
<a href="#537" id="537" class="l"> 537: </a>        <span class="php-var">$this</span>-&gt;FromName = <span class="php-var">$name</span>;
<a href="#538" id="538" class="l"> 538: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$auto</span>) {
<a href="#539" id="539" class="l"> 539: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword1">empty</span>(<span class="php-var">$this</span>-&gt;ReplyTo)) {
<a href="#540" id="540" class="l"> 540: </a>                <span class="php-var">$this</span>-&gt;AddAnAddress(<span class="php-quote">'ReplyTo'</span>, <span class="php-var">$address</span>, <span class="php-var">$name</span>);
<a href="#541" id="541" class="l"> 541: </a>            }
<a href="#542" id="542" class="l"> 542: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword1">empty</span>(<span class="php-var">$this</span>-&gt;Sender)) {
<a href="#543" id="543" class="l"> 543: </a>                <span class="php-var">$this</span>-&gt;Sender = <span class="php-var">$address</span>;
<a href="#544" id="544" class="l"> 544: </a>            }
<a href="#545" id="545" class="l"> 545: </a>        }
<a href="#546" id="546" class="l"> 546: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#547" id="547" class="l"> 547: </a>    }
<a href="#548" id="548" class="l"> 548: </a>
<a href="#549" id="549" class="l"> 549: </a>    <span class="php-comment">/**
</span><a href="#550" id="550" class="l"> 550: </a><span class="php-comment">     * Check that a string looks roughly like an email address should
</span><a href="#551" id="551" class="l"> 551: </a><span class="php-comment">     * Static so it can be used without instantiation
</span><a href="#552" id="552" class="l"> 552: </a><span class="php-comment">     * Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator
</span><a href="#553" id="553" class="l"> 553: </a><span class="php-comment">     * Conforms approximately to RFC2822
</span><a href="#554" id="554" class="l"> 554: </a><span class="php-comment">     * @link http://www.hexillion.com/samples/#Regex Original pattern found here
</span><a href="#555" id="555" class="l"> 555: </a><span class="php-comment">     * @param string $address The email address to check
</span><a href="#556" id="556" class="l"> 556: </a><span class="php-comment">     * @return boolean
</span><a href="#557" id="557" class="l"> 557: </a><span class="php-comment">     * @static
</span><a href="#558" id="558" class="l"> 558: </a><span class="php-comment">     * @access public
</span><a href="#559" id="559" class="l"> 559: </a><span class="php-comment">     */</span>
<a href="#560" id="560" class="l"> 560: </a>
<a href="#561" id="561" class="l"> 561: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> ValidateAddress(<span class="php-var">$address</span>)
<a href="#562" id="562" class="l"> 562: </a>    {
<a href="#563" id="563" class="l"> 563: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">function_exists</span>(<span class="php-quote">'filter_var'</span>)) { <span class="php-comment">//Introduced in PHP 5.2</span>
<a href="#564" id="564" class="l"> 564: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword2">filter_var</span>(<span class="php-var">$address</span>, FILTER_VALIDATE_EMAIL) === <span class="php-keyword1">FALSE</span>) {
<a href="#565" id="565" class="l"> 565: </a>                <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#566" id="566" class="l"> 566: </a>            } <span class="php-keyword1">else</span> {
<a href="#567" id="567" class="l"> 567: </a>                <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#568" id="568" class="l"> 568: </a>            }
<a href="#569" id="569" class="l"> 569: </a>        } <span class="php-keyword1">else</span> {
<a href="#570" id="570" class="l"> 570: </a>            <span class="php-keyword1">return</span> <span class="php-keyword2">preg_match</span>(
<a href="#571" id="571" class="l"> 571: </a>                    <span class="php-quote">'/^(?:[\w\!\#\$\%\&amp;\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&amp;\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/'</span>,
<a href="#572" id="572" class="l"> 572: </a>                    <span class="php-var">$address</span>);
<a href="#573" id="573" class="l"> 573: </a>        }
<a href="#574" id="574" class="l"> 574: </a>    }
<a href="#575" id="575" class="l"> 575: </a>
<a href="#576" id="576" class="l"> 576: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#577" id="577" class="l"> 577: </a>    <span class="php-comment">// METHODS, MAIL SENDING</span>
<a href="#578" id="578" class="l"> 578: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#579" id="579" class="l"> 579: </a>
<a href="#580" id="580" class="l"> 580: </a>    <span class="php-comment">/**
</span><a href="#581" id="581" class="l"> 581: </a><span class="php-comment">     * Creates message and assigns Mailer. If the message is
</span><a href="#582" id="582" class="l"> 582: </a><span class="php-comment">     * not sent successfully then it returns FALSE.  Use the ErrorInfo
</span><a href="#583" id="583" class="l"> 583: </a><span class="php-comment">     * variable to view description of the error.
</span><a href="#584" id="584" class="l"> 584: </a><span class="php-comment">     * @return bool
</span><a href="#585" id="585" class="l"> 585: </a><span class="php-comment">     */</span>
<a href="#586" id="586" class="l"> 586: </a>
<a href="#587" id="587" class="l"> 587: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> Send()
<a href="#588" id="588" class="l"> 588: </a>    {
<a href="#589" id="589" class="l"> 589: </a>        <span class="php-keyword1">try</span> {
<a href="#590" id="590" class="l"> 590: </a>            <span class="php-keyword1">if</span> ((<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;to) + <span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;cc) + <span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;bcc)) &lt; <span class="php-num">1</span>) {
<a href="#591" id="591" class="l"> 591: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'provide_address'</span>),
<a href="#592" id="592" class="l"> 592: </a>                        self::STOP_CRITICAL);
<a href="#593" id="593" class="l"> 593: </a>            }
<a href="#594" id="594" class="l"> 594: </a>
<a href="#595" id="595" class="l"> 595: </a>            <span class="php-comment">// Set whether the message is multipart/alternative</span>
<a href="#596" id="596" class="l"> 596: </a>            <span class="php-keyword1">if</span> (!<span class="php-keyword1">empty</span>(<span class="php-var">$this</span>-&gt;AltBody)) {
<a href="#597" id="597" class="l"> 597: </a>                <span class="php-var">$this</span>-&gt;ContentType = <span class="php-quote">'multipart/alternative'</span>;
<a href="#598" id="598" class="l"> 598: </a>            }
<a href="#599" id="599" class="l"> 599: </a>
<a href="#600" id="600" class="l"> 600: </a>            <span class="php-var">$this</span>-&gt;error_count = <span class="php-num">0</span>; <span class="php-comment">// reset errors</span>
<a href="#601" id="601" class="l"> 601: </a>            <span class="php-var">$this</span>-&gt;SetMessageType();
<a href="#602" id="602" class="l"> 602: </a>            <span class="php-var">$header</span> = <span class="php-var">$this</span>-&gt;CreateHeader();
<a href="#603" id="603" class="l"> 603: </a>            <span class="php-var">$body</span> = <span class="php-var">$this</span>-&gt;CreateBody();
<a href="#604" id="604" class="l"> 604: </a>
<a href="#605" id="605" class="l"> 605: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword1">empty</span>(<span class="php-var">$this</span>-&gt;Body)) {
<a href="#606" id="606" class="l"> 606: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'empty_message'</span>),
<a href="#607" id="607" class="l"> 607: </a>                        self::STOP_CRITICAL);
<a href="#608" id="608" class="l"> 608: </a>            }
<a href="#609" id="609" class="l"> 609: </a>
<a href="#610" id="610" class="l"> 610: </a>            <span class="php-comment">// digitally sign with DKIM if enabled</span>
<a href="#611" id="611" class="l"> 611: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;DKIM_domain &amp;&amp; <span class="php-var">$this</span>-&gt;DKIM_private) {
<a href="#612" id="612" class="l"> 612: </a>                <span class="php-var">$header_dkim</span> = <span class="php-var">$this</span>-&gt;DKIM_Add(<span class="php-var">$header</span>, <span class="php-var">$this</span>-&gt;Subject, <span class="php-var">$body</span>);
<a href="#613" id="613" class="l"> 613: </a>                <span class="php-var">$header</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\r\n&quot;</span>, <span class="php-quote">&quot;\n&quot;</span>, <span class="php-var">$header_dkim</span>) . <span class="php-var">$header</span>;
<a href="#614" id="614" class="l"> 614: </a>            }
<a href="#615" id="615" class="l"> 615: </a>
<a href="#616" id="616" class="l"> 616: </a>            <span class="php-comment">// Choose the mailer and send through it</span>
<a href="#617" id="617" class="l"> 617: </a>            <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>-&gt;Mailer) {
<a href="#618" id="618" class="l"> 618: </a>                <span class="php-keyword1">case</span> <span class="php-quote">'sendmail'</span>:
<a href="#619" id="619" class="l"> 619: </a>                    <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;SendmailSend(<span class="php-var">$header</span>, <span class="php-var">$body</span>);
<a href="#620" id="620" class="l"> 620: </a>                <span class="php-keyword1">case</span> <span class="php-quote">'smtp'</span>:
<a href="#621" id="621" class="l"> 621: </a>                    <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;SmtpSend(<span class="php-var">$header</span>, <span class="php-var">$body</span>);
<a href="#622" id="622" class="l"> 622: </a>                <span class="php-keyword1">default</span>:
<a href="#623" id="623" class="l"> 623: </a>                    <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;MailSend(<span class="php-var">$header</span>, <span class="php-var">$body</span>);
<a href="#624" id="624" class="l"> 624: </a>            }
<a href="#625" id="625" class="l"> 625: </a>
<a href="#626" id="626" class="l"> 626: </a>        } <span class="php-keyword1">catch</span> (phpmailerException <span class="php-var">$e</span>) {
<a href="#627" id="627" class="l"> 627: </a>            <span class="php-var">$this</span>-&gt;SetError(<span class="php-var">$e</span>-&gt;getMessage());
<a href="#628" id="628" class="l"> 628: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;exceptions) {
<a href="#629" id="629" class="l"> 629: </a>                <span class="php-keyword1">throw</span> <span class="php-var">$e</span>;
<a href="#630" id="630" class="l"> 630: </a>            }
<a href="#631" id="631" class="l"> 631: </a>            <span class="php-keyword1">echo</span> <span class="php-var">$e</span>-&gt;getMessage() . <span class="php-quote">&quot;\n&quot;</span>;
<a href="#632" id="632" class="l"> 632: </a>            <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#633" id="633" class="l"> 633: </a>        }
<a href="#634" id="634" class="l"> 634: </a>    }
<a href="#635" id="635" class="l"> 635: </a>
<a href="#636" id="636" class="l"> 636: </a>    <span class="php-comment">/**
</span><a href="#637" id="637" class="l"> 637: </a><span class="php-comment">     * Sends mail using the $Sendmail program.
</span><a href="#638" id="638" class="l"> 638: </a><span class="php-comment">     * @param string $header The message headers
</span><a href="#639" id="639" class="l"> 639: </a><span class="php-comment">     * @param string $body The message body
</span><a href="#640" id="640" class="l"> 640: </a><span class="php-comment">     * @access protected
</span><a href="#641" id="641" class="l"> 641: </a><span class="php-comment">     * @return bool
</span><a href="#642" id="642" class="l"> 642: </a><span class="php-comment">     */</span>
<a href="#643" id="643" class="l"> 643: </a>
<a href="#644" id="644" class="l"> 644: </a>    <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> SendmailSend(<span class="php-var">$header</span>, <span class="php-var">$body</span>)
<a href="#645" id="645" class="l"> 645: </a>    {
<a href="#646" id="646" class="l"> 646: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;Sender != <span class="php-quote">''</span>) {
<a href="#647" id="647" class="l"> 647: </a>            <span class="php-var">$sendmail</span> = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;%s -oi -f %s -t&quot;</span>,
<a href="#648" id="648" class="l"> 648: </a>                    <span class="php-keyword2">escapeshellcmd</span>(<span class="php-var">$this</span>-&gt;Sendmail),
<a href="#649" id="649" class="l"> 649: </a>                    <span class="php-keyword2">escapeshellarg</span>(<span class="php-var">$this</span>-&gt;Sender));
<a href="#650" id="650" class="l"> 650: </a>        } <span class="php-keyword1">else</span> {
<a href="#651" id="651" class="l"> 651: </a>            <span class="php-var">$sendmail</span> = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;%s -oi -t&quot;</span>, <span class="php-keyword2">escapeshellcmd</span>(<span class="php-var">$this</span>-&gt;Sendmail));
<a href="#652" id="652" class="l"> 652: </a>        }
<a href="#653" id="653" class="l"> 653: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;SingleTo === <span class="php-keyword1">TRUE</span>) {
<a href="#654" id="654" class="l"> 654: </a>            <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;SingleToArray <span class="php-keyword1">as</span> <span class="php-var">$key</span> =&gt; <span class="php-var">$val</span>) {
<a href="#655" id="655" class="l"> 655: </a>                <span class="php-keyword1">if</span> (!@<span class="php-var">$mail</span> = <span class="php-keyword2">popen</span>(<span class="php-var">$sendmail</span>, <span class="php-quote">'w'</span>)) {
<a href="#656" id="656" class="l"> 656: </a>                    <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#657" id="657" class="l"> 657: </a>                            <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'execute'</span>) . <span class="php-var">$this</span>-&gt;Sendmail,
<a href="#658" id="658" class="l"> 658: </a>                            self::STOP_CRITICAL);
<a href="#659" id="659" class="l"> 659: </a>                }
<a href="#660" id="660" class="l"> 660: </a>                <span class="php-keyword2">fputs</span>(<span class="php-var">$mail</span>, <span class="php-quote">&quot;To: &quot;</span> . <span class="php-var">$val</span> . <span class="php-quote">&quot;\n&quot;</span>);
<a href="#661" id="661" class="l"> 661: </a>                <span class="php-keyword2">fputs</span>(<span class="php-var">$mail</span>, <span class="php-var">$header</span>);
<a href="#662" id="662" class="l"> 662: </a>                <span class="php-keyword2">fputs</span>(<span class="php-var">$mail</span>, <span class="php-var">$body</span>);
<a href="#663" id="663" class="l"> 663: </a>                <span class="php-var">$result</span> = <span class="php-keyword2">pclose</span>(<span class="php-var">$mail</span>);
<a href="#664" id="664" class="l"> 664: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#665" id="665" class="l"> 665: </a>                <span class="php-var">$isSent</span> = (<span class="php-var">$result</span> == <span class="php-num">0</span>) ? <span class="php-num">1</span> : <span class="php-num">0</span>;
<a href="#666" id="666" class="l"> 666: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$val</span>, <span class="php-var">$this</span>-&gt;cc, <span class="php-var">$this</span>-&gt;bcc,
<a href="#667" id="667" class="l"> 667: </a>                                <span class="php-var">$this</span>-&gt;Subject, <span class="php-var">$body</span>);
<a href="#668" id="668" class="l"> 668: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$result</span> != <span class="php-num">0</span>) {
<a href="#669" id="669" class="l"> 669: </a>                    <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#670" id="670" class="l"> 670: </a>                            <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'execute'</span>) . <span class="php-var">$this</span>-&gt;Sendmail,
<a href="#671" id="671" class="l"> 671: </a>                            self::STOP_CRITICAL);
<a href="#672" id="672" class="l"> 672: </a>                }
<a href="#673" id="673" class="l"> 673: </a>            }
<a href="#674" id="674" class="l"> 674: </a>        } <span class="php-keyword1">else</span> {
<a href="#675" id="675" class="l"> 675: </a>            <span class="php-keyword1">if</span> (!@<span class="php-var">$mail</span> = <span class="php-keyword2">popen</span>(<span class="php-var">$sendmail</span>, <span class="php-quote">'w'</span>)) {
<a href="#676" id="676" class="l"> 676: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#677" id="677" class="l"> 677: </a>                        <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'execute'</span>) . <span class="php-var">$this</span>-&gt;Sendmail,
<a href="#678" id="678" class="l"> 678: </a>                        self::STOP_CRITICAL);
<a href="#679" id="679" class="l"> 679: </a>            }
<a href="#680" id="680" class="l"> 680: </a>            <span class="php-keyword2">fputs</span>(<span class="php-var">$mail</span>, <span class="php-var">$header</span>);
<a href="#681" id="681" class="l"> 681: </a>            <span class="php-keyword2">fputs</span>(<span class="php-var">$mail</span>, <span class="php-var">$body</span>);
<a href="#682" id="682" class="l"> 682: </a>            <span class="php-var">$result</span> = <span class="php-keyword2">pclose</span>(<span class="php-var">$mail</span>);
<a href="#683" id="683" class="l"> 683: </a>            <span class="php-comment">// implement call back function if it exists</span>
<a href="#684" id="684" class="l"> 684: </a>            <span class="php-var">$isSent</span> = (<span class="php-var">$result</span> == <span class="php-num">0</span>) ? <span class="php-num">1</span> : <span class="php-num">0</span>;
<a href="#685" id="685" class="l"> 685: </a>            <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$this</span>-&gt;to, <span class="php-var">$this</span>-&gt;cc, <span class="php-var">$this</span>-&gt;bcc,
<a href="#686" id="686" class="l"> 686: </a>                            <span class="php-var">$this</span>-&gt;Subject, <span class="php-var">$body</span>);
<a href="#687" id="687" class="l"> 687: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$result</span> != <span class="php-num">0</span>) {
<a href="#688" id="688" class="l"> 688: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#689" id="689" class="l"> 689: </a>                        <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'execute'</span>) . <span class="php-var">$this</span>-&gt;Sendmail,
<a href="#690" id="690" class="l"> 690: </a>                        self::STOP_CRITICAL);
<a href="#691" id="691" class="l"> 691: </a>            }
<a href="#692" id="692" class="l"> 692: </a>        }
<a href="#693" id="693" class="l"> 693: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#694" id="694" class="l"> 694: </a>    }
<a href="#695" id="695" class="l"> 695: </a>
<a href="#696" id="696" class="l"> 696: </a>    <span class="php-comment">/**
</span><a href="#697" id="697" class="l"> 697: </a><span class="php-comment">     * Sends mail using the PHP mail() function.
</span><a href="#698" id="698" class="l"> 698: </a><span class="php-comment">     * @param string $header The message headers
</span><a href="#699" id="699" class="l"> 699: </a><span class="php-comment">     * @param string $body The message body
</span><a href="#700" id="700" class="l"> 700: </a><span class="php-comment">     * @access protected
</span><a href="#701" id="701" class="l"> 701: </a><span class="php-comment">     * @return bool
</span><a href="#702" id="702" class="l"> 702: </a><span class="php-comment">     */</span>
<a href="#703" id="703" class="l"> 703: </a>
<a href="#704" id="704" class="l"> 704: </a>    <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> MailSend(<span class="php-var">$header</span>, <span class="php-var">$body</span>)
<a href="#705" id="705" class="l"> 705: </a>    {
<a href="#706" id="706" class="l"> 706: </a>        <span class="php-var">$toArr</span> = <span class="php-keyword1">array</span>();
<a href="#707" id="707" class="l"> 707: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;to <span class="php-keyword1">as</span> <span class="php-var">$t</span>) {
<a href="#708" id="708" class="l"> 708: </a>            <span class="php-var">$toArr</span>[] = <span class="php-var">$this</span>-&gt;AddrFormat(<span class="php-var">$t</span>);
<a href="#709" id="709" class="l"> 709: </a>        }
<a href="#710" id="710" class="l"> 710: </a>        <span class="php-var">$to</span> = <span class="php-keyword2">implode</span>(<span class="php-quote">', '</span>, <span class="php-var">$toArr</span>);
<a href="#711" id="711" class="l"> 711: </a>
<a href="#712" id="712" class="l"> 712: </a>        <span class="php-var">$params</span> = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;-oi -f %s&quot;</span>, <span class="php-var">$this</span>-&gt;Sender);
<a href="#713" id="713" class="l"> 713: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;Sender != <span class="php-quote">''</span> &amp;&amp; <span class="php-keyword2">strlen</span>(<span class="php-keyword2">ini_get</span>(<span class="php-quote">'safe_mode'</span>)) &lt; <span class="php-num">1</span>) {
<a href="#714" id="714" class="l"> 714: </a>            <span class="php-var">$old_from</span> = <span class="php-keyword2">ini_get</span>(<span class="php-quote">'sendmail_from'</span>);
<a href="#715" id="715" class="l"> 715: </a>            <span class="php-keyword2">ini_set</span>(<span class="php-quote">'sendmail_from'</span>, <span class="php-var">$this</span>-&gt;Sender);
<a href="#716" id="716" class="l"> 716: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;SingleTo === <span class="php-keyword1">TRUE</span> &amp;&amp; <span class="php-keyword2">count</span>(<span class="php-var">$toArr</span>) &gt; <span class="php-num">1</span>) {
<a href="#717" id="717" class="l"> 717: </a>                <span class="php-keyword1">foreach</span> (<span class="php-var">$toArr</span> <span class="php-keyword1">as</span> <span class="php-var">$key</span> =&gt; <span class="php-var">$val</span>) {
<a href="#718" id="718" class="l"> 718: </a>                    <span class="php-var">$rt</span> = @<span class="php-keyword2">mail</span>(<span class="php-var">$val</span>,
<a href="#719" id="719" class="l"> 719: </a>                            <span class="php-var">$this</span>-&gt;EncodeHeader(
<a href="#720" id="720" class="l"> 720: </a>                                            <span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$this</span>-&gt;Subject)),
<a href="#721" id="721" class="l"> 721: </a>                            <span class="php-var">$body</span>, <span class="php-var">$header</span>, <span class="php-var">$params</span>);
<a href="#722" id="722" class="l"> 722: </a>                    <span class="php-comment">// implement call back function if it exists</span>
<a href="#723" id="723" class="l"> 723: </a>                    <span class="php-var">$isSent</span> = (<span class="php-var">$rt</span> == <span class="php-num">1</span>) ? <span class="php-num">1</span> : <span class="php-num">0</span>;
<a href="#724" id="724" class="l"> 724: </a>                    <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$val</span>, <span class="php-var">$this</span>-&gt;cc, <span class="php-var">$this</span>-&gt;bcc,
<a href="#725" id="725" class="l"> 725: </a>                                    <span class="php-var">$this</span>-&gt;Subject, <span class="php-var">$body</span>);
<a href="#726" id="726" class="l"> 726: </a>                }
<a href="#727" id="727" class="l"> 727: </a>            } <span class="php-keyword1">else</span> {
<a href="#728" id="728" class="l"> 728: </a>                <span class="php-var">$rt</span> = @<span class="php-keyword2">mail</span>(<span class="php-var">$to</span>,
<a href="#729" id="729" class="l"> 729: </a>                        <span class="php-var">$this</span>-&gt;EncodeHeader(<span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$this</span>-&gt;Subject)),
<a href="#730" id="730" class="l"> 730: </a>                        <span class="php-var">$body</span>, <span class="php-var">$header</span>, <span class="php-var">$params</span>);
<a href="#731" id="731" class="l"> 731: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#732" id="732" class="l"> 732: </a>                <span class="php-var">$isSent</span> = (<span class="php-var">$rt</span> == <span class="php-num">1</span>) ? <span class="php-num">1</span> : <span class="php-num">0</span>;
<a href="#733" id="733" class="l"> 733: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$to</span>, <span class="php-var">$this</span>-&gt;cc, <span class="php-var">$this</span>-&gt;bcc,
<a href="#734" id="734" class="l"> 734: </a>                                <span class="php-var">$this</span>-&gt;Subject, <span class="php-var">$body</span>);
<a href="#735" id="735" class="l"> 735: </a>            }
<a href="#736" id="736" class="l"> 736: </a>        } <span class="php-keyword1">else</span> {
<a href="#737" id="737" class="l"> 737: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;SingleTo === <span class="php-keyword1">TRUE</span> &amp;&amp; <span class="php-keyword2">count</span>(<span class="php-var">$toArr</span>) &gt; <span class="php-num">1</span>) {
<a href="#738" id="738" class="l"> 738: </a>                <span class="php-keyword1">foreach</span> (<span class="php-var">$toArr</span> <span class="php-keyword1">as</span> <span class="php-var">$key</span> =&gt; <span class="php-var">$val</span>) {
<a href="#739" id="739" class="l"> 739: </a>                    <span class="php-var">$rt</span> = @<span class="php-keyword2">mail</span>(<span class="php-var">$val</span>,
<a href="#740" id="740" class="l"> 740: </a>                            <span class="php-var">$this</span>-&gt;EncodeHeader(
<a href="#741" id="741" class="l"> 741: </a>                                            <span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$this</span>-&gt;Subject)),
<a href="#742" id="742" class="l"> 742: </a>                            <span class="php-var">$body</span>, <span class="php-var">$header</span>, <span class="php-var">$params</span>);
<a href="#743" id="743" class="l"> 743: </a>                    <span class="php-comment">// implement call back function if it exists</span>
<a href="#744" id="744" class="l"> 744: </a>                    <span class="php-var">$isSent</span> = (<span class="php-var">$rt</span> == <span class="php-num">1</span>) ? <span class="php-num">1</span> : <span class="php-num">0</span>;
<a href="#745" id="745" class="l"> 745: </a>                    <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$val</span>, <span class="php-var">$this</span>-&gt;cc, <span class="php-var">$this</span>-&gt;bcc,
<a href="#746" id="746" class="l"> 746: </a>                                    <span class="php-var">$this</span>-&gt;Subject, <span class="php-var">$body</span>);
<a href="#747" id="747" class="l"> 747: </a>                }
<a href="#748" id="748" class="l"> 748: </a>            } <span class="php-keyword1">else</span> {
<a href="#749" id="749" class="l"> 749: </a>                <span class="php-var">$rt</span> = @<span class="php-keyword2">mail</span>(<span class="php-var">$to</span>,
<a href="#750" id="750" class="l"> 750: </a>                        <span class="php-var">$this</span>-&gt;EncodeHeader(<span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$this</span>-&gt;Subject)),
<a href="#751" id="751" class="l"> 751: </a>                        <span class="php-var">$body</span>, <span class="php-var">$header</span>);
<a href="#752" id="752" class="l"> 752: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#753" id="753" class="l"> 753: </a>                <span class="php-var">$isSent</span> = (<span class="php-var">$rt</span> == <span class="php-num">1</span>) ? <span class="php-num">1</span> : <span class="php-num">0</span>;
<a href="#754" id="754" class="l"> 754: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$to</span>, <span class="php-var">$this</span>-&gt;cc, <span class="php-var">$this</span>-&gt;bcc,
<a href="#755" id="755" class="l"> 755: </a>                                <span class="php-var">$this</span>-&gt;Subject, <span class="php-var">$body</span>);
<a href="#756" id="756" class="l"> 756: </a>            }
<a href="#757" id="757" class="l"> 757: </a>        }
<a href="#758" id="758" class="l"> 758: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$old_from</span>)) {
<a href="#759" id="759" class="l"> 759: </a>            <span class="php-keyword2">ini_set</span>(<span class="php-quote">'sendmail_from'</span>, <span class="php-var">$old_from</span>);
<a href="#760" id="760" class="l"> 760: </a>        }
<a href="#761" id="761" class="l"> 761: </a>        <span class="php-keyword1">if</span> (!<span class="php-var">$rt</span>) {
<a href="#762" id="762" class="l"> 762: </a>            <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'instantiate'</span>),
<a href="#763" id="763" class="l"> 763: </a>                    self::STOP_CRITICAL);
<a href="#764" id="764" class="l"> 764: </a>        }
<a href="#765" id="765" class="l"> 765: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#766" id="766" class="l"> 766: </a>    }
<a href="#767" id="767" class="l"> 767: </a>
<a href="#768" id="768" class="l"> 768: </a>    <span class="php-comment">/**
</span><a href="#769" id="769" class="l"> 769: </a><span class="php-comment">     * Sends mail via SMTP using PhpSMTP
</span><a href="#770" id="770" class="l"> 770: </a><span class="php-comment">     * Returns FALSE if there is a bad MAIL FROM, RCPT, or DATA input.
</span><a href="#771" id="771" class="l"> 771: </a><span class="php-comment">     * @param string $header The message headers
</span><a href="#772" id="772" class="l"> 772: </a><span class="php-comment">     * @param string $body The message body
</span><a href="#773" id="773" class="l"> 773: </a><span class="php-comment">     * @uses SMTP
</span><a href="#774" id="774" class="l"> 774: </a><span class="php-comment">     * @access protected
</span><a href="#775" id="775" class="l"> 775: </a><span class="php-comment">     * @return bool
</span><a href="#776" id="776" class="l"> 776: </a><span class="php-comment">     */</span>
<a href="#777" id="777" class="l"> 777: </a>
<a href="#778" id="778" class="l"> 778: </a>    <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> SmtpSend(<span class="php-var">$header</span>, <span class="php-var">$body</span>)
<a href="#779" id="779" class="l"> 779: </a>    {
<a href="#780" id="780" class="l"> 780: </a>        <span class="php-keyword1">require_once</span> <span class="php-var">$this</span>-&gt;PluginDir . <span class="php-quote">'class.smtp.php'</span>;
<a href="#781" id="781" class="l"> 781: </a>        <span class="php-var">$bad_rcpt</span> = <span class="php-keyword1">array</span>();
<a href="#782" id="782" class="l"> 782: </a>
<a href="#783" id="783" class="l"> 783: </a>        <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;SmtpConnect()) {
<a href="#784" id="784" class="l"> 784: </a>            <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'smtp_connect_failed'</span>),
<a href="#785" id="785" class="l"> 785: </a>                    self::STOP_CRITICAL);
<a href="#786" id="786" class="l"> 786: </a>        }
<a href="#787" id="787" class="l"> 787: </a>        <span class="php-var">$smtp_from</span> = (<span class="php-var">$this</span>-&gt;Sender == <span class="php-quote">''</span>) ? <span class="php-var">$this</span>-&gt;From : <span class="php-var">$this</span>-&gt;Sender;
<a href="#788" id="788" class="l"> 788: </a>        <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;smtp
<a href="#789" id="789" class="l"> 789: </a>                -&gt;<span class="php-keyword2">Mail</span>(<span class="php-var">$smtp_from</span>)) {
<a href="#790" id="790" class="l"> 790: </a>            <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#791" id="791" class="l"> 791: </a>                    <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'from_failed'</span>) . <span class="php-var">$smtp_from</span>,
<a href="#792" id="792" class="l"> 792: </a>                    self::STOP_CRITICAL);
<a href="#793" id="793" class="l"> 793: </a>        }
<a href="#794" id="794" class="l"> 794: </a>
<a href="#795" id="795" class="l"> 795: </a>        <span class="php-comment">// Attempt to send attach all recipients</span>
<a href="#796" id="796" class="l"> 796: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;to <span class="php-keyword1">as</span> <span class="php-var">$to</span>) {
<a href="#797" id="797" class="l"> 797: </a>            <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;smtp
<a href="#798" id="798" class="l"> 798: </a>                    -&gt;Recipient(<span class="php-var">$to</span>[<span class="php-num">0</span>])) {
<a href="#799" id="799" class="l"> 799: </a>                <span class="php-var">$bad_rcpt</span>[] = <span class="php-var">$to</span>[<span class="php-num">0</span>];
<a href="#800" id="800" class="l"> 800: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#801" id="801" class="l"> 801: </a>                <span class="php-var">$isSent</span> = <span class="php-num">0</span>;
<a href="#802" id="802" class="l"> 802: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$to</span>[<span class="php-num">0</span>], <span class="php-quote">''</span>, <span class="php-quote">''</span>, <span class="php-var">$this</span>-&gt;Subject,
<a href="#803" id="803" class="l"> 803: </a>                                <span class="php-var">$body</span>);
<a href="#804" id="804" class="l"> 804: </a>            } <span class="php-keyword1">else</span> {
<a href="#805" id="805" class="l"> 805: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#806" id="806" class="l"> 806: </a>                <span class="php-var">$isSent</span> = <span class="php-num">1</span>;
<a href="#807" id="807" class="l"> 807: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$to</span>[<span class="php-num">0</span>], <span class="php-quote">''</span>, <span class="php-quote">''</span>, <span class="php-var">$this</span>-&gt;Subject,
<a href="#808" id="808" class="l"> 808: </a>                                <span class="php-var">$body</span>);
<a href="#809" id="809" class="l"> 809: </a>            }
<a href="#810" id="810" class="l"> 810: </a>        }
<a href="#811" id="811" class="l"> 811: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;cc <span class="php-keyword1">as</span> <span class="php-var">$cc</span>) {
<a href="#812" id="812" class="l"> 812: </a>            <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;smtp
<a href="#813" id="813" class="l"> 813: </a>                    -&gt;Recipient(<span class="php-var">$cc</span>[<span class="php-num">0</span>])) {
<a href="#814" id="814" class="l"> 814: </a>                <span class="php-var">$bad_rcpt</span>[] = <span class="php-var">$cc</span>[<span class="php-num">0</span>];
<a href="#815" id="815" class="l"> 815: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#816" id="816" class="l"> 816: </a>                <span class="php-var">$isSent</span> = <span class="php-num">0</span>;
<a href="#817" id="817" class="l"> 817: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-quote">''</span>, <span class="php-var">$cc</span>[<span class="php-num">0</span>], <span class="php-quote">''</span>, <span class="php-var">$this</span>-&gt;Subject,
<a href="#818" id="818" class="l"> 818: </a>                                <span class="php-var">$body</span>);
<a href="#819" id="819" class="l"> 819: </a>            } <span class="php-keyword1">else</span> {
<a href="#820" id="820" class="l"> 820: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#821" id="821" class="l"> 821: </a>                <span class="php-var">$isSent</span> = <span class="php-num">1</span>;
<a href="#822" id="822" class="l"> 822: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-quote">''</span>, <span class="php-var">$cc</span>[<span class="php-num">0</span>], <span class="php-quote">''</span>, <span class="php-var">$this</span>-&gt;Subject,
<a href="#823" id="823" class="l"> 823: </a>                                <span class="php-var">$body</span>);
<a href="#824" id="824" class="l"> 824: </a>            }
<a href="#825" id="825" class="l"> 825: </a>        }
<a href="#826" id="826" class="l"> 826: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;bcc <span class="php-keyword1">as</span> <span class="php-var">$bcc</span>) {
<a href="#827" id="827" class="l"> 827: </a>            <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;smtp
<a href="#828" id="828" class="l"> 828: </a>                    -&gt;Recipient(<span class="php-var">$bcc</span>[<span class="php-num">0</span>])) {
<a href="#829" id="829" class="l"> 829: </a>                <span class="php-var">$bad_rcpt</span>[] = <span class="php-var">$bcc</span>[<span class="php-num">0</span>];
<a href="#830" id="830" class="l"> 830: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#831" id="831" class="l"> 831: </a>                <span class="php-var">$isSent</span> = <span class="php-num">0</span>;
<a href="#832" id="832" class="l"> 832: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-quote">''</span>, <span class="php-quote">''</span>, <span class="php-var">$bcc</span>[<span class="php-num">0</span>], <span class="php-var">$this</span>-&gt;Subject,
<a href="#833" id="833" class="l"> 833: </a>                                <span class="php-var">$body</span>);
<a href="#834" id="834" class="l"> 834: </a>            } <span class="php-keyword1">else</span> {
<a href="#835" id="835" class="l"> 835: </a>                <span class="php-comment">// implement call back function if it exists</span>
<a href="#836" id="836" class="l"> 836: </a>                <span class="php-var">$isSent</span> = <span class="php-num">1</span>;
<a href="#837" id="837" class="l"> 837: </a>                <span class="php-var">$this</span>-&gt;doCallback(<span class="php-var">$isSent</span>, <span class="php-quote">''</span>, <span class="php-quote">''</span>, <span class="php-var">$bcc</span>[<span class="php-num">0</span>], <span class="php-var">$this</span>-&gt;Subject,
<a href="#838" id="838" class="l"> 838: </a>                                <span class="php-var">$body</span>);
<a href="#839" id="839" class="l"> 839: </a>            }
<a href="#840" id="840" class="l"> 840: </a>        }
<a href="#841" id="841" class="l"> 841: </a>
<a href="#842" id="842" class="l"> 842: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$bad_rcpt</span>) &gt; <span class="php-num">0</span>) { <span class="php-comment">//Create error message for any bad addresses</span>
<a href="#843" id="843" class="l"> 843: </a>            <span class="php-var">$badaddresses</span> = <span class="php-keyword2">implode</span>(<span class="php-quote">', '</span>, <span class="php-var">$bad_rcpt</span>);
<a href="#844" id="844" class="l"> 844: </a>            <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#845" id="845" class="l"> 845: </a>                    <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'recipients_failed'</span>) . <span class="php-var">$badaddresses</span>);
<a href="#846" id="846" class="l"> 846: </a>        }
<a href="#847" id="847" class="l"> 847: </a>        <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;smtp
<a href="#848" id="848" class="l"> 848: </a>                -&gt;Data(<span class="php-var">$header</span> . <span class="php-var">$body</span>)) {
<a href="#849" id="849" class="l"> 849: </a>            <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'data_not_accepted'</span>),
<a href="#850" id="850" class="l"> 850: </a>                    self::STOP_CRITICAL);
<a href="#851" id="851" class="l"> 851: </a>        }
<a href="#852" id="852" class="l"> 852: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;SMTPKeepAlive == <span class="php-keyword1">TRUE</span>) {
<a href="#853" id="853" class="l"> 853: </a>            <span class="php-var">$this</span>-&gt;smtp
<a href="#854" id="854" class="l"> 854: </a>                    -&gt;<span class="php-keyword2">Reset</span>();
<a href="#855" id="855" class="l"> 855: </a>        }
<a href="#856" id="856" class="l"> 856: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#857" id="857" class="l"> 857: </a>    }
<a href="#858" id="858" class="l"> 858: </a>
<a href="#859" id="859" class="l"> 859: </a>    <span class="php-comment">/**
</span><a href="#860" id="860" class="l"> 860: </a><span class="php-comment">     * Initiates a connection to an SMTP server.
</span><a href="#861" id="861" class="l"> 861: </a><span class="php-comment">     * Returns FALSE if the operation failed.
</span><a href="#862" id="862" class="l"> 862: </a><span class="php-comment">     * @uses SMTP
</span><a href="#863" id="863" class="l"> 863: </a><span class="php-comment">     * @access public
</span><a href="#864" id="864" class="l"> 864: </a><span class="php-comment">     * @return bool
</span><a href="#865" id="865" class="l"> 865: </a><span class="php-comment">     */</span>
<a href="#866" id="866" class="l"> 866: </a>
<a href="#867" id="867" class="l"> 867: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> SmtpConnect()
<a href="#868" id="868" class="l"> 868: </a>    {
<a href="#869" id="869" class="l"> 869: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">is_null</span>(<span class="php-var">$this</span>-&gt;smtp)) {
<a href="#870" id="870" class="l"> 870: </a>            <span class="php-var">$this</span>-&gt;smtp = <span class="php-keyword1">new</span> SMTP();
<a href="#871" id="871" class="l"> 871: </a>        }
<a href="#872" id="872" class="l"> 872: </a>
<a href="#873" id="873" class="l"> 873: </a>        <span class="php-var">$this</span>-&gt;smtp
<a href="#874" id="874" class="l"> 874: </a>                -&gt;do_debug = <span class="php-var">$this</span>-&gt;SMTPDebug;
<a href="#875" id="875" class="l"> 875: </a>        <span class="php-var">$hosts</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">';'</span>, <span class="php-var">$this</span>-&gt;Host);
<a href="#876" id="876" class="l"> 876: </a>        <span class="php-var">$index</span> = <span class="php-num">0</span>;
<a href="#877" id="877" class="l"> 877: </a>        <span class="php-var">$connection</span> = <span class="php-var">$this</span>-&gt;smtp
<a href="#878" id="878" class="l"> 878: </a>                -&gt;Connected();
<a href="#879" id="879" class="l"> 879: </a>
<a href="#880" id="880" class="l"> 880: </a>        <span class="php-comment">// Retry while there is no connection</span>
<a href="#881" id="881" class="l"> 881: </a>        <span class="php-keyword1">try</span> {
<a href="#882" id="882" class="l"> 882: </a>            <span class="php-keyword1">while</span> (<span class="php-var">$index</span> &lt; <span class="php-keyword2">count</span>(<span class="php-var">$hosts</span>) &amp;&amp; !<span class="php-var">$connection</span>) {
<a href="#883" id="883" class="l"> 883: </a>                <span class="php-var">$hostinfo</span> = <span class="php-keyword1">array</span>();
<a href="#884" id="884" class="l"> 884: </a>                <span class="php-keyword1">if</span> (<span class="php-keyword2">preg_match</span>(<span class="php-quote">'/^(.+):([0-9]+)$/'</span>, <span class="php-var">$hosts</span>[<span class="php-var">$index</span>], <span class="php-var">$hostinfo</span>)) {
<a href="#885" id="885" class="l"> 885: </a>                    <span class="php-var">$host</span> = <span class="php-var">$hostinfo</span>[<span class="php-num">1</span>];
<a href="#886" id="886" class="l"> 886: </a>                    <span class="php-var">$port</span> = <span class="php-var">$hostinfo</span>[<span class="php-num">2</span>];
<a href="#887" id="887" class="l"> 887: </a>                } <span class="php-keyword1">else</span> {
<a href="#888" id="888" class="l"> 888: </a>                    <span class="php-var">$host</span> = <span class="php-var">$hosts</span>[<span class="php-var">$index</span>];
<a href="#889" id="889" class="l"> 889: </a>                    <span class="php-var">$port</span> = <span class="php-var">$this</span>-&gt;Port;
<a href="#890" id="890" class="l"> 890: </a>                }
<a href="#891" id="891" class="l"> 891: </a>
<a href="#892" id="892" class="l"> 892: </a>                <span class="php-var">$tls</span> = (<span class="php-var">$this</span>-&gt;SMTPSecure == <span class="php-quote">'tls'</span>);
<a href="#893" id="893" class="l"> 893: </a>                <span class="php-var">$ssl</span> = (<span class="php-var">$this</span>-&gt;SMTPSecure == <span class="php-quote">'ssl'</span>);
<a href="#894" id="894" class="l"> 894: </a>
<a href="#895" id="895" class="l"> 895: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;smtp
<a href="#896" id="896" class="l"> 896: </a>                        -&gt;Connect((<span class="php-var">$ssl</span> ? <span class="php-quote">'ssl://'</span> : <span class="php-quote">''</span>) . <span class="php-var">$host</span>, <span class="php-var">$port</span>,
<a href="#897" id="897" class="l"> 897: </a>                                <span class="php-var">$this</span>-&gt;Timeout)) {
<a href="#898" id="898" class="l"> 898: </a>
<a href="#899" id="899" class="l"> 899: </a>                    <span class="php-var">$hello</span> = (<span class="php-var">$this</span>-&gt;Helo != <span class="php-quote">''</span> ? <span class="php-var">$this</span>-&gt;Helo
<a href="#900" id="900" class="l"> 900: </a>                            : <span class="php-var">$this</span>-&gt;ServerHostname());
<a href="#901" id="901" class="l"> 901: </a>                    <span class="php-var">$this</span>-&gt;smtp
<a href="#902" id="902" class="l"> 902: </a>                            -&gt;Hello(<span class="php-var">$hello</span>);
<a href="#903" id="903" class="l"> 903: </a>
<a href="#904" id="904" class="l"> 904: </a>                    <span class="php-keyword1">if</span> (<span class="php-var">$tls</span>) {
<a href="#905" id="905" class="l"> 905: </a>                        <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;smtp
<a href="#906" id="906" class="l"> 906: </a>                                -&gt;StartTLS()) {
<a href="#907" id="907" class="l"> 907: </a>                            <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'tls'</span>));
<a href="#908" id="908" class="l"> 908: </a>                        }
<a href="#909" id="909" class="l"> 909: </a>
<a href="#910" id="910" class="l"> 910: </a>                        <span class="php-comment">//We must resend HELO after tls negotiation</span>
<a href="#911" id="911" class="l"> 911: </a>                        <span class="php-var">$this</span>-&gt;smtp
<a href="#912" id="912" class="l"> 912: </a>                                -&gt;Hello(<span class="php-var">$hello</span>);
<a href="#913" id="913" class="l"> 913: </a>                    }
<a href="#914" id="914" class="l"> 914: </a>
<a href="#915" id="915" class="l"> 915: </a>                    <span class="php-var">$connection</span> = <span class="php-keyword1">TRUE</span>;
<a href="#916" id="916" class="l"> 916: </a>                    <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;SMTPAuth) {
<a href="#917" id="917" class="l"> 917: </a>                        <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;smtp
<a href="#918" id="918" class="l"> 918: </a>                                -&gt;Authenticate(<span class="php-var">$this</span>-&gt;Username, <span class="php-var">$this</span>-&gt;Password)) {
<a href="#919" id="919" class="l"> 919: </a>                            <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#920" id="920" class="l"> 920: </a>                                    <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'authenticate'</span>));
<a href="#921" id="921" class="l"> 921: </a>                        }
<a href="#922" id="922" class="l"> 922: </a>                    }
<a href="#923" id="923" class="l"> 923: </a>                }
<a href="#924" id="924" class="l"> 924: </a>                <span class="php-var">$index</span>++;
<a href="#925" id="925" class="l"> 925: </a>                <span class="php-keyword1">if</span> (!<span class="php-var">$connection</span>) {
<a href="#926" id="926" class="l"> 926: </a>                    <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'connect_host'</span>));
<a href="#927" id="927" class="l"> 927: </a>                }
<a href="#928" id="928" class="l"> 928: </a>            }
<a href="#929" id="929" class="l"> 929: </a>        } <span class="php-keyword1">catch</span> (phpmailerException <span class="php-var">$e</span>) {
<a href="#930" id="930" class="l"> 930: </a>            <span class="php-var">$this</span>-&gt;smtp
<a href="#931" id="931" class="l"> 931: </a>                    -&gt;<span class="php-keyword2">Reset</span>();
<a href="#932" id="932" class="l"> 932: </a>            <span class="php-keyword1">throw</span> <span class="php-var">$e</span>;
<a href="#933" id="933" class="l"> 933: </a>        }
<a href="#934" id="934" class="l"> 934: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#935" id="935" class="l"> 935: </a>    }
<a href="#936" id="936" class="l"> 936: </a>
<a href="#937" id="937" class="l"> 937: </a>    <span class="php-comment">/**
</span><a href="#938" id="938" class="l"> 938: </a><span class="php-comment">     * Closes the active SMTP session if one exists.
</span><a href="#939" id="939" class="l"> 939: </a><span class="php-comment">     * @return void
</span><a href="#940" id="940" class="l"> 940: </a><span class="php-comment">     */</span>
<a href="#941" id="941" class="l"> 941: </a>
<a href="#942" id="942" class="l"> 942: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> SmtpClose()
<a href="#943" id="943" class="l"> 943: </a>    {
<a href="#944" id="944" class="l"> 944: </a>        <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_null</span>(<span class="php-var">$this</span>-&gt;smtp)) {
<a href="#945" id="945" class="l"> 945: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;smtp
<a href="#946" id="946" class="l"> 946: </a>                    -&gt;Connected()) {
<a href="#947" id="947" class="l"> 947: </a>                <span class="php-var">$this</span>-&gt;smtp
<a href="#948" id="948" class="l"> 948: </a>                        -&gt;Quit();
<a href="#949" id="949" class="l"> 949: </a>                <span class="php-var">$this</span>-&gt;smtp
<a href="#950" id="950" class="l"> 950: </a>                        -&gt;Close();
<a href="#951" id="951" class="l"> 951: </a>            }
<a href="#952" id="952" class="l"> 952: </a>        }
<a href="#953" id="953" class="l"> 953: </a>    }
<a href="#954" id="954" class="l"> 954: </a>
<a href="#955" id="955" class="l"> 955: </a>    <span class="php-comment">/**
</span><a href="#956" id="956" class="l"> 956: </a><span class="php-comment">     * Sets the language for all class error messages.
</span><a href="#957" id="957" class="l"> 957: </a><span class="php-comment">     * Returns FALSE if it cannot load the language file.  The default language is English.
</span><a href="#958" id="958" class="l"> 958: </a><span class="php-comment">     * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: &quot;br&quot;)
</span><a href="#959" id="959" class="l"> 959: </a><span class="php-comment">     * @param string $lang_path Path to the language file directory
</span><a href="#960" id="960" class="l"> 960: </a><span class="php-comment">     * @access public
</span><a href="#961" id="961" class="l"> 961: </a><span class="php-comment">     */</span>
<a href="#962" id="962" class="l"> 962: </a>    <span class="php-keyword1">function</span> SetLanguage(<span class="php-var">$langcode</span> = <span class="php-quote">'en'</span>, <span class="php-var">$lang_path</span> = <span class="php-quote">'language/'</span>)
<a href="#963" id="963" class="l"> 963: </a>    {
<a href="#964" id="964" class="l"> 964: </a>        <span class="php-comment">//Define full set of translatable strings</span>
<a href="#965" id="965" class="l"> 965: </a>        <span class="php-var">$PHPMAILER_LANG</span> = <span class="php-keyword1">array</span>(
<a href="#966" id="966" class="l"> 966: </a>                <span class="php-quote">'provide_address'</span> =&gt; <span class="php-quote">'You must provide at least one recipient email address.'</span>,
<a href="#967" id="967" class="l"> 967: </a>                <span class="php-quote">'mailer_not_supported'</span> =&gt; <span class="php-quote">' mailer is not supported.'</span>,
<a href="#968" id="968" class="l"> 968: </a>                <span class="php-quote">'execute'</span> =&gt; <span class="php-quote">'Could not execute: '</span>,
<a href="#969" id="969" class="l"> 969: </a>                <span class="php-quote">'instantiate'</span> =&gt; <span class="php-quote">'Could not instantiate mail function.'</span>,
<a href="#970" id="970" class="l"> 970: </a>                <span class="php-quote">'authenticate'</span> =&gt; <span class="php-quote">'SMTP Error: Could not authenticate.'</span>,
<a href="#971" id="971" class="l"> 971: </a>                <span class="php-quote">'from_failed'</span> =&gt; <span class="php-quote">'The following From address failed: '</span>,
<a href="#972" id="972" class="l"> 972: </a>                <span class="php-quote">'recipients_failed'</span> =&gt; <span class="php-quote">'SMTP Error: The following recipients failed: '</span>,
<a href="#973" id="973" class="l"> 973: </a>                <span class="php-quote">'data_not_accepted'</span> =&gt; <span class="php-quote">'SMTP Error: Data not accepted.'</span>,
<a href="#974" id="974" class="l"> 974: </a>                <span class="php-quote">'connect_host'</span> =&gt; <span class="php-quote">'SMTP Error: Could not connect to SMTP host.'</span>,
<a href="#975" id="975" class="l"> 975: </a>                <span class="php-quote">'file_access'</span> =&gt; <span class="php-quote">'Could not access file: '</span>,
<a href="#976" id="976" class="l"> 976: </a>                <span class="php-quote">'file_open'</span> =&gt; <span class="php-quote">'File Error: Could not open file: '</span>,
<a href="#977" id="977" class="l"> 977: </a>                <span class="php-quote">'encoding'</span> =&gt; <span class="php-quote">'Unknown encoding: '</span>,
<a href="#978" id="978" class="l"> 978: </a>                <span class="php-quote">'signing'</span> =&gt; <span class="php-quote">'Signing Error: '</span>,
<a href="#979" id="979" class="l"> 979: </a>                <span class="php-quote">'smtp_error'</span> =&gt; <span class="php-quote">'SMTP server error: '</span>,
<a href="#980" id="980" class="l"> 980: </a>                <span class="php-quote">'empty_message'</span> =&gt; <span class="php-quote">'Message body empty'</span>,
<a href="#981" id="981" class="l"> 981: </a>                <span class="php-quote">'invalid_address'</span> =&gt; <span class="php-quote">'Invalid address'</span>,
<a href="#982" id="982" class="l"> 982: </a>                <span class="php-quote">'variable_set'</span> =&gt; <span class="php-quote">'Cannot set or reset variable: '</span>
<a href="#983" id="983" class="l"> 983: </a>        );
<a href="#984" id="984" class="l"> 984: </a>        <span class="php-comment">//Overwrite language-specific strings. This way we'll never have missing translations - no more &quot;language string failed to load&quot;!</span>
<a href="#985" id="985" class="l"> 985: </a>        <span class="php-var">$l</span> = <span class="php-keyword1">TRUE</span>;
<a href="#986" id="986" class="l"> 986: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$langcode</span> != <span class="php-quote">'en'</span>) { <span class="php-comment">//There is no English translation file</span>
<a href="#987" id="987" class="l"> 987: </a>            <span class="php-var">$l</span> = @<span class="php-keyword1">include</span> <span class="php-var">$lang_path</span> . <span class="php-quote">'phpmailer.lang-'</span> . <span class="php-var">$langcode</span> . <span class="php-quote">'.php'</span>;
<a href="#988" id="988" class="l"> 988: </a>        }
<a href="#989" id="989" class="l"> 989: </a>        <span class="php-var">$this</span>-&gt;language = <span class="php-var">$PHPMAILER_LANG</span>;
<a href="#990" id="990" class="l"> 990: </a>        <span class="php-keyword1">return</span> (<span class="php-var">$l</span> == <span class="php-keyword1">TRUE</span>); <span class="php-comment">//Returns FALSE if language not found</span>
<a href="#991" id="991" class="l"> 991: </a>    }
<a href="#992" id="992" class="l"> 992: </a>
<a href="#993" id="993" class="l"> 993: </a>    <span class="php-comment">/**
</span><a href="#994" id="994" class="l"> 994: </a><span class="php-comment">     * Return the current array of language strings
</span><a href="#995" id="995" class="l"> 995: </a><span class="php-comment">     * @return array
</span><a href="#996" id="996" class="l"> 996: </a><span class="php-comment">     */</span>
<a href="#997" id="997" class="l"> 997: </a>
<a href="#998" id="998" class="l"> 998: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> GetTranslations()
<a href="#999" id="999" class="l"> 999: </a>    {
<a href="#1000" id="1000" class="l">1000: </a>        <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;language;
<a href="#1001" id="1001" class="l">1001: </a>    }
<a href="#1002" id="1002" class="l">1002: </a>
<a href="#1003" id="1003" class="l">1003: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#1004" id="1004" class="l">1004: </a>    <span class="php-comment">// METHODS, MESSAGE CREATION</span>
<a href="#1005" id="1005" class="l">1005: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#1006" id="1006" class="l">1006: </a>
<a href="#1007" id="1007" class="l">1007: </a>    <span class="php-comment">/**
</span><a href="#1008" id="1008" class="l">1008: </a><span class="php-comment">     * Creates recipient headers.
</span><a href="#1009" id="1009" class="l">1009: </a><span class="php-comment">     * @access public
</span><a href="#1010" id="1010" class="l">1010: </a><span class="php-comment">     * @return string
</span><a href="#1011" id="1011" class="l">1011: </a><span class="php-comment">     */</span>
<a href="#1012" id="1012" class="l">1012: </a>
<a href="#1013" id="1013" class="l">1013: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddrAppend(<span class="php-var">$type</span>, <span class="php-var">$addr</span>)
<a href="#1014" id="1014" class="l">1014: </a>    {
<a href="#1015" id="1015" class="l">1015: </a>        <span class="php-var">$addr_str</span> = <span class="php-var">$type</span> . <span class="php-quote">': '</span>;
<a href="#1016" id="1016" class="l">1016: </a>        <span class="php-var">$addresses</span> = <span class="php-keyword1">array</span>();
<a href="#1017" id="1017" class="l">1017: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$addr</span> <span class="php-keyword1">as</span> <span class="php-var">$a</span>) {
<a href="#1018" id="1018" class="l">1018: </a>            <span class="php-var">$addresses</span>[] = <span class="php-var">$this</span>-&gt;AddrFormat(<span class="php-var">$a</span>);
<a href="#1019" id="1019" class="l">1019: </a>        }
<a href="#1020" id="1020" class="l">1020: </a>        <span class="php-var">$addr_str</span> .= <span class="php-keyword2">implode</span>(<span class="php-quote">', '</span>, <span class="php-var">$addresses</span>);
<a href="#1021" id="1021" class="l">1021: </a>        <span class="php-var">$addr_str</span> .= <span class="php-var">$this</span>-&gt;LE;
<a href="#1022" id="1022" class="l">1022: </a>
<a href="#1023" id="1023" class="l">1023: </a>        <span class="php-keyword1">return</span> <span class="php-var">$addr_str</span>;
<a href="#1024" id="1024" class="l">1024: </a>    }
<a href="#1025" id="1025" class="l">1025: </a>
<a href="#1026" id="1026" class="l">1026: </a>    <span class="php-comment">/**
</span><a href="#1027" id="1027" class="l">1027: </a><span class="php-comment">     * Formats an address correctly.
</span><a href="#1028" id="1028" class="l">1028: </a><span class="php-comment">     * @access public
</span><a href="#1029" id="1029" class="l">1029: </a><span class="php-comment">     * @return string
</span><a href="#1030" id="1030" class="l">1030: </a><span class="php-comment">     */</span>
<a href="#1031" id="1031" class="l">1031: </a>
<a href="#1032" id="1032" class="l">1032: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddrFormat(<span class="php-var">$addr</span>)
<a href="#1033" id="1033" class="l">1033: </a>    {
<a href="#1034" id="1034" class="l">1034: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword1">empty</span>(<span class="php-var">$addr</span>[<span class="php-num">1</span>])) {
<a href="#1035" id="1035" class="l">1035: </a>            <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$addr</span>[<span class="php-num">0</span>]);
<a href="#1036" id="1036" class="l">1036: </a>        } <span class="php-keyword1">else</span> {
<a href="#1037" id="1037" class="l">1037: </a>            <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;EncodeHeader(<span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$addr</span>[<span class="php-num">1</span>]), <span class="php-quote">'phrase'</span>)
<a href="#1038" id="1038" class="l">1038: </a>                    . <span class="php-quote">&quot; &lt;&quot;</span> . <span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$addr</span>[<span class="php-num">0</span>]) . <span class="php-quote">&quot;&gt;&quot;</span>;
<a href="#1039" id="1039" class="l">1039: </a>        }
<a href="#1040" id="1040" class="l">1040: </a>    }
<a href="#1041" id="1041" class="l">1041: </a>
<a href="#1042" id="1042" class="l">1042: </a>    <span class="php-comment">/**
</span><a href="#1043" id="1043" class="l">1043: </a><span class="php-comment">     * Wraps message for use with mailers that do not
</span><a href="#1044" id="1044" class="l">1044: </a><span class="php-comment">     * automatically perform wrapping and for quoted-printable.
</span><a href="#1045" id="1045" class="l">1045: </a><span class="php-comment">     * Original written by philippe.
</span><a href="#1046" id="1046" class="l">1046: </a><span class="php-comment">     * @param string $message The message to wrap
</span><a href="#1047" id="1047" class="l">1047: </a><span class="php-comment">     * @param integer $length The line length to wrap to
</span><a href="#1048" id="1048" class="l">1048: </a><span class="php-comment">     * @param boolean $qp_mode Whether to run in Quoted-Printable mode
</span><a href="#1049" id="1049" class="l">1049: </a><span class="php-comment">     * @access public
</span><a href="#1050" id="1050" class="l">1050: </a><span class="php-comment">     * @return string
</span><a href="#1051" id="1051" class="l">1051: </a><span class="php-comment">     */</span>
<a href="#1052" id="1052" class="l">1052: </a>
<a href="#1053" id="1053" class="l">1053: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> WrapText(<span class="php-var">$message</span>, <span class="php-var">$length</span>, <span class="php-var">$qp_mode</span> = <span class="php-keyword1">FALSE</span>)
<a href="#1054" id="1054" class="l">1054: </a>    {
<a href="#1055" id="1055" class="l">1055: </a>        <span class="php-var">$soft_break</span> = (<span class="php-var">$qp_mode</span>) ? <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot; =%s&quot;</span>, <span class="php-var">$this</span>-&gt;LE) : <span class="php-var">$this</span>-&gt;LE;
<a href="#1056" id="1056" class="l">1056: </a>        <span class="php-comment">// If utf-8 encoding is used, we will need to make sure we don't</span>
<a href="#1057" id="1057" class="l">1057: </a>        <span class="php-comment">// split multibyte characters when we wrap</span>
<a href="#1058" id="1058" class="l">1058: </a>        <span class="php-var">$is_utf8</span> = (<span class="php-keyword2">strtolower</span>(<span class="php-var">$this</span>-&gt;CharSet) == <span class="php-quote">&quot;utf-8&quot;</span>);
<a href="#1059" id="1059" class="l">1059: </a>
<a href="#1060" id="1060" class="l">1060: </a>        <span class="php-var">$message</span> = <span class="php-var">$this</span>-&gt;FixEOL(<span class="php-var">$message</span>);
<a href="#1061" id="1061" class="l">1061: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$message</span>, -<span class="php-num">1</span>) == <span class="php-var">$this</span>-&gt;LE) {
<a href="#1062" id="1062" class="l">1062: </a>            <span class="php-var">$message</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$message</span>, <span class="php-num">0</span>, -<span class="php-num">1</span>);
<a href="#1063" id="1063" class="l">1063: </a>        }
<a href="#1064" id="1064" class="l">1064: </a>
<a href="#1065" id="1065" class="l">1065: </a>        <span class="php-var">$line</span> = <span class="php-keyword2">explode</span>(<span class="php-var">$this</span>-&gt;LE, <span class="php-var">$message</span>);
<a href="#1066" id="1066" class="l">1066: </a>        <span class="php-var">$message</span> = <span class="php-quote">''</span>;
<a href="#1067" id="1067" class="l">1067: </a>        <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> &lt; <span class="php-keyword2">count</span>(<span class="php-var">$line</span>); <span class="php-var">$i</span>++) {
<a href="#1068" id="1068" class="l">1068: </a>            <span class="php-var">$line_part</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">' '</span>, <span class="php-var">$line</span>[<span class="php-var">$i</span>]);
<a href="#1069" id="1069" class="l">1069: </a>            <span class="php-var">$buf</span> = <span class="php-quote">''</span>;
<a href="#1070" id="1070" class="l">1070: </a>            <span class="php-keyword1">for</span> (<span class="php-var">$e</span> = <span class="php-num">0</span>; <span class="php-var">$e</span> &lt; <span class="php-keyword2">count</span>(<span class="php-var">$line_part</span>); <span class="php-var">$e</span>++) {
<a href="#1071" id="1071" class="l">1071: </a>                <span class="php-var">$word</span> = <span class="php-var">$line_part</span>[<span class="php-var">$e</span>];
<a href="#1072" id="1072" class="l">1072: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$qp_mode</span> <span class="php-keyword1">and</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$word</span>) &gt; <span class="php-var">$length</span>)) {
<a href="#1073" id="1073" class="l">1073: </a>                    <span class="php-var">$space_left</span> = <span class="php-var">$length</span> - <span class="php-keyword2">strlen</span>(<span class="php-var">$buf</span>) - <span class="php-num">1</span>;
<a href="#1074" id="1074" class="l">1074: </a>                    <span class="php-keyword1">if</span> (<span class="php-var">$e</span> != <span class="php-num">0</span>) {
<a href="#1075" id="1075" class="l">1075: </a>                        <span class="php-keyword1">if</span> (<span class="php-var">$space_left</span> &gt; <span class="php-num">20</span>) {
<a href="#1076" id="1076" class="l">1076: </a>                            <span class="php-var">$len</span> = <span class="php-var">$space_left</span>;
<a href="#1077" id="1077" class="l">1077: </a>                            <span class="php-keyword1">if</span> (<span class="php-var">$is_utf8</span>) {
<a href="#1078" id="1078" class="l">1078: </a>                                <span class="php-var">$len</span> = <span class="php-var">$this</span>-&gt;UTF8CharBoundary(<span class="php-var">$word</span>, <span class="php-var">$len</span>);
<a href="#1079" id="1079" class="l">1079: </a>                            } <span class="php-keyword1">elseif</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$word</span>, <span class="php-var">$len</span> - <span class="php-num">1</span>, <span class="php-num">1</span>) == <span class="php-quote">&quot;=&quot;</span>) {
<a href="#1080" id="1080" class="l">1080: </a>                                <span class="php-var">$len</span>--;
<a href="#1081" id="1081" class="l">1081: </a>                            } <span class="php-keyword1">elseif</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$word</span>, <span class="php-var">$len</span> - <span class="php-num">2</span>, <span class="php-num">1</span>) == <span class="php-quote">&quot;=&quot;</span>) {
<a href="#1082" id="1082" class="l">1082: </a>                                <span class="php-var">$len</span> -= <span class="php-num">2</span>;
<a href="#1083" id="1083" class="l">1083: </a>                            }
<a href="#1084" id="1084" class="l">1084: </a>                            <span class="php-var">$part</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$word</span>, <span class="php-num">0</span>, <span class="php-var">$len</span>);
<a href="#1085" id="1085" class="l">1085: </a>                            <span class="php-var">$word</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$word</span>, <span class="php-var">$len</span>);
<a href="#1086" id="1086" class="l">1086: </a>                            <span class="php-var">$buf</span> .= <span class="php-quote">' '</span> . <span class="php-var">$part</span>;
<a href="#1087" id="1087" class="l">1087: </a>                            <span class="php-var">$message</span> .= <span class="php-var">$buf</span> . <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;=%s&quot;</span>, <span class="php-var">$this</span>-&gt;LE);
<a href="#1088" id="1088" class="l">1088: </a>                        } <span class="php-keyword1">else</span> {
<a href="#1089" id="1089" class="l">1089: </a>                            <span class="php-var">$message</span> .= <span class="php-var">$buf</span> . <span class="php-var">$soft_break</span>;
<a href="#1090" id="1090" class="l">1090: </a>                        }
<a href="#1091" id="1091" class="l">1091: </a>                        <span class="php-var">$buf</span> = <span class="php-quote">''</span>;
<a href="#1092" id="1092" class="l">1092: </a>                    }
<a href="#1093" id="1093" class="l">1093: </a>                    <span class="php-keyword1">while</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$word</span>) &gt; <span class="php-num">0</span>) {
<a href="#1094" id="1094" class="l">1094: </a>                        <span class="php-var">$len</span> = <span class="php-var">$length</span>;
<a href="#1095" id="1095" class="l">1095: </a>                        <span class="php-keyword1">if</span> (<span class="php-var">$is_utf8</span>) {
<a href="#1096" id="1096" class="l">1096: </a>                            <span class="php-var">$len</span> = <span class="php-var">$this</span>-&gt;UTF8CharBoundary(<span class="php-var">$word</span>, <span class="php-var">$len</span>);
<a href="#1097" id="1097" class="l">1097: </a>                        } <span class="php-keyword1">elseif</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$word</span>, <span class="php-var">$len</span> - <span class="php-num">1</span>, <span class="php-num">1</span>) == <span class="php-quote">&quot;=&quot;</span>) {
<a href="#1098" id="1098" class="l">1098: </a>                            <span class="php-var">$len</span>--;
<a href="#1099" id="1099" class="l">1099: </a>                        } <span class="php-keyword1">elseif</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$word</span>, <span class="php-var">$len</span> - <span class="php-num">2</span>, <span class="php-num">1</span>) == <span class="php-quote">&quot;=&quot;</span>) {
<a href="#1100" id="1100" class="l">1100: </a>                            <span class="php-var">$len</span> -= <span class="php-num">2</span>;
<a href="#1101" id="1101" class="l">1101: </a>                        }
<a href="#1102" id="1102" class="l">1102: </a>                        <span class="php-var">$part</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$word</span>, <span class="php-num">0</span>, <span class="php-var">$len</span>);
<a href="#1103" id="1103" class="l">1103: </a>                        <span class="php-var">$word</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$word</span>, <span class="php-var">$len</span>);
<a href="#1104" id="1104" class="l">1104: </a>
<a href="#1105" id="1105" class="l">1105: </a>                        <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$word</span>) &gt; <span class="php-num">0</span>) {
<a href="#1106" id="1106" class="l">1106: </a>                            <span class="php-var">$message</span> .= <span class="php-var">$part</span> . <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;=%s&quot;</span>, <span class="php-var">$this</span>-&gt;LE);
<a href="#1107" id="1107" class="l">1107: </a>                        } <span class="php-keyword1">else</span> {
<a href="#1108" id="1108" class="l">1108: </a>                            <span class="php-var">$buf</span> = <span class="php-var">$part</span>;
<a href="#1109" id="1109" class="l">1109: </a>                        }
<a href="#1110" id="1110" class="l">1110: </a>                    }
<a href="#1111" id="1111" class="l">1111: </a>                } <span class="php-keyword1">else</span> {
<a href="#1112" id="1112" class="l">1112: </a>                    <span class="php-var">$buf_o</span> = <span class="php-var">$buf</span>;
<a href="#1113" id="1113" class="l">1113: </a>                    <span class="php-var">$buf</span> .= (<span class="php-var">$e</span> == <span class="php-num">0</span>) ? <span class="php-var">$word</span> : (<span class="php-quote">' '</span> . <span class="php-var">$word</span>);
<a href="#1114" id="1114" class="l">1114: </a>
<a href="#1115" id="1115" class="l">1115: </a>                    <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$buf</span>) &gt; <span class="php-var">$length</span> <span class="php-keyword1">and</span> <span class="php-var">$buf_o</span> != <span class="php-quote">''</span>) {
<a href="#1116" id="1116" class="l">1116: </a>                        <span class="php-var">$message</span> .= <span class="php-var">$buf_o</span> . <span class="php-var">$soft_break</span>;
<a href="#1117" id="1117" class="l">1117: </a>                        <span class="php-var">$buf</span> = <span class="php-var">$word</span>;
<a href="#1118" id="1118" class="l">1118: </a>                    }
<a href="#1119" id="1119" class="l">1119: </a>                }
<a href="#1120" id="1120" class="l">1120: </a>            }
<a href="#1121" id="1121" class="l">1121: </a>            <span class="php-var">$message</span> .= <span class="php-var">$buf</span> . <span class="php-var">$this</span>-&gt;LE;
<a href="#1122" id="1122" class="l">1122: </a>        }
<a href="#1123" id="1123" class="l">1123: </a>
<a href="#1124" id="1124" class="l">1124: </a>        <span class="php-keyword1">return</span> <span class="php-var">$message</span>;
<a href="#1125" id="1125" class="l">1125: </a>    }
<a href="#1126" id="1126" class="l">1126: </a>
<a href="#1127" id="1127" class="l">1127: </a>    <span class="php-comment">/**
</span><a href="#1128" id="1128" class="l">1128: </a><span class="php-comment">     * Finds last character boundary prior to maxLength in a utf-8
</span><a href="#1129" id="1129" class="l">1129: </a><span class="php-comment">     * quoted (printable) encoded string.
</span><a href="#1130" id="1130" class="l">1130: </a><span class="php-comment">     * Original written by Colin Brown.
</span><a href="#1131" id="1131" class="l">1131: </a><span class="php-comment">     * @access public
</span><a href="#1132" id="1132" class="l">1132: </a><span class="php-comment">     * @param string $encodedText utf-8 QP text
</span><a href="#1133" id="1133" class="l">1133: </a><span class="php-comment">     * @param int    $maxLength   find last character boundary prior to this length
</span><a href="#1134" id="1134" class="l">1134: </a><span class="php-comment">     * @return int
</span><a href="#1135" id="1135" class="l">1135: </a><span class="php-comment">     */</span>
<a href="#1136" id="1136" class="l">1136: </a>
<a href="#1137" id="1137" class="l">1137: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> UTF8CharBoundary(<span class="php-var">$encodedText</span>, <span class="php-var">$maxLength</span>)
<a href="#1138" id="1138" class="l">1138: </a>    {
<a href="#1139" id="1139" class="l">1139: </a>        <span class="php-var">$foundSplitPos</span> = <span class="php-keyword1">FALSE</span>;
<a href="#1140" id="1140" class="l">1140: </a>        <span class="php-var">$lookBack</span> = <span class="php-num">3</span>;
<a href="#1141" id="1141" class="l">1141: </a>        <span class="php-keyword1">while</span> (!<span class="php-var">$foundSplitPos</span>) {
<a href="#1142" id="1142" class="l">1142: </a>            <span class="php-var">$lastChunk</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$encodedText</span>, <span class="php-var">$maxLength</span> - <span class="php-var">$lookBack</span>, <span class="php-var">$lookBack</span>);
<a href="#1143" id="1143" class="l">1143: </a>            <span class="php-var">$encodedCharPos</span> = <span class="php-keyword2">strpos</span>(<span class="php-var">$lastChunk</span>, <span class="php-quote">&quot;=&quot;</span>);
<a href="#1144" id="1144" class="l">1144: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$encodedCharPos</span> !== <span class="php-keyword1">FALSE</span>) {
<a href="#1145" id="1145" class="l">1145: </a>                <span class="php-comment">// Found start of encoded character byte within $lookBack block.</span>
<a href="#1146" id="1146" class="l">1146: </a>                <span class="php-comment">// Check the encoded byte value (the 2 chars after the '=')</span>
<a href="#1147" id="1147" class="l">1147: </a>                <span class="php-var">$hex</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$encodedText</span>,
<a href="#1148" id="1148" class="l">1148: </a>                        <span class="php-var">$maxLength</span> - <span class="php-var">$lookBack</span> + <span class="php-var">$encodedCharPos</span> + <span class="php-num">1</span>, <span class="php-num">2</span>);
<a href="#1149" id="1149" class="l">1149: </a>                <span class="php-var">$dec</span> = <span class="php-keyword2">hexdec</span>(<span class="php-var">$hex</span>);
<a href="#1150" id="1150" class="l">1150: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$dec</span> &lt; <span class="php-num">128</span>) { <span class="php-comment">// Single byte character.</span>
<a href="#1151" id="1151" class="l">1151: </a>                <span class="php-comment">// If the encoded char was found at pos 0, it will fit</span>
<a href="#1152" id="1152" class="l">1152: </a>                <span class="php-comment">// otherwise reduce maxLength to start of the encoded char</span>
<a href="#1153" id="1153" class="l">1153: </a>                    <span class="php-var">$maxLength</span> = (<span class="php-var">$encodedCharPos</span> == <span class="php-num">0</span>) ? <span class="php-var">$maxLength</span>
<a href="#1154" id="1154" class="l">1154: </a>                            : <span class="php-var">$maxLength</span> - (<span class="php-var">$lookBack</span> - <span class="php-var">$encodedCharPos</span>);
<a href="#1155" id="1155" class="l">1155: </a>                    <span class="php-var">$foundSplitPos</span> = <span class="php-keyword1">TRUE</span>;
<a href="#1156" id="1156" class="l">1156: </a>                } <span class="php-keyword1">elseif</span> (<span class="php-var">$dec</span> &gt;= <span class="php-num">192</span>) { <span class="php-comment">// First byte of a multi byte character</span>
<a href="#1157" id="1157" class="l">1157: </a>                <span class="php-comment">// Reduce maxLength to split at start of character</span>
<a href="#1158" id="1158" class="l">1158: </a>                    <span class="php-var">$maxLength</span> = <span class="php-var">$maxLength</span> - (<span class="php-var">$lookBack</span> - <span class="php-var">$encodedCharPos</span>);
<a href="#1159" id="1159" class="l">1159: </a>                    <span class="php-var">$foundSplitPos</span> = <span class="php-keyword1">TRUE</span>;
<a href="#1160" id="1160" class="l">1160: </a>                } <span class="php-keyword1">elseif</span> (<span class="php-var">$dec</span> &lt; <span class="php-num">192</span>) { <span class="php-comment">// Middle byte of a multi byte character, look further back</span>
<a href="#1161" id="1161" class="l">1161: </a>                    <span class="php-var">$lookBack</span> += <span class="php-num">3</span>;
<a href="#1162" id="1162" class="l">1162: </a>                }
<a href="#1163" id="1163" class="l">1163: </a>            } <span class="php-keyword1">else</span> {
<a href="#1164" id="1164" class="l">1164: </a>                <span class="php-comment">// No encoded character found</span>
<a href="#1165" id="1165" class="l">1165: </a>                <span class="php-var">$foundSplitPos</span> = <span class="php-keyword1">TRUE</span>;
<a href="#1166" id="1166" class="l">1166: </a>            }
<a href="#1167" id="1167" class="l">1167: </a>        }
<a href="#1168" id="1168" class="l">1168: </a>        <span class="php-keyword1">return</span> <span class="php-var">$maxLength</span>;
<a href="#1169" id="1169" class="l">1169: </a>    }
<a href="#1170" id="1170" class="l">1170: </a>
<a href="#1171" id="1171" class="l">1171: </a>    <span class="php-comment">/**
</span><a href="#1172" id="1172" class="l">1172: </a><span class="php-comment">     * Set the body wrapping.
</span><a href="#1173" id="1173" class="l">1173: </a><span class="php-comment">     * @access public
</span><a href="#1174" id="1174" class="l">1174: </a><span class="php-comment">     * @return void
</span><a href="#1175" id="1175" class="l">1175: </a><span class="php-comment">     */</span>
<a href="#1176" id="1176" class="l">1176: </a>
<a href="#1177" id="1177" class="l">1177: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> SetWordWrap()
<a href="#1178" id="1178" class="l">1178: </a>    {
<a href="#1179" id="1179" class="l">1179: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;<span class="php-keyword2">WordWrap</span> &lt; <span class="php-num">1</span>) {
<a href="#1180" id="1180" class="l">1180: </a>            <span class="php-keyword1">return</span>;
<a href="#1181" id="1181" class="l">1181: </a>        }
<a href="#1182" id="1182" class="l">1182: </a>
<a href="#1183" id="1183" class="l">1183: </a>        <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>-&gt;message_type) {
<a href="#1184" id="1184" class="l">1184: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'alt'</span>:
<a href="#1185" id="1185" class="l">1185: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'alt_attachments'</span>:
<a href="#1186" id="1186" class="l">1186: </a>                <span class="php-var">$this</span>-&gt;AltBody = <span class="php-var">$this</span>-&gt;WrapText(<span class="php-var">$this</span>-&gt;AltBody,
<a href="#1187" id="1187" class="l">1187: </a>                                <span class="php-var">$this</span>-&gt;<span class="php-keyword2">WordWrap</span>);
<a href="#1188" id="1188" class="l">1188: </a>                <span class="php-keyword1">break</span>;
<a href="#1189" id="1189" class="l">1189: </a>            <span class="php-keyword1">default</span>:
<a href="#1190" id="1190" class="l">1190: </a>                <span class="php-var">$this</span>-&gt;Body = <span class="php-var">$this</span>-&gt;WrapText(<span class="php-var">$this</span>-&gt;Body, <span class="php-var">$this</span>-&gt;<span class="php-keyword2">WordWrap</span>);
<a href="#1191" id="1191" class="l">1191: </a>                <span class="php-keyword1">break</span>;
<a href="#1192" id="1192" class="l">1192: </a>        }
<a href="#1193" id="1193" class="l">1193: </a>    }
<a href="#1194" id="1194" class="l">1194: </a>
<a href="#1195" id="1195" class="l">1195: </a>    <span class="php-comment">/**
</span><a href="#1196" id="1196" class="l">1196: </a><span class="php-comment">     * Assembles message header.
</span><a href="#1197" id="1197" class="l">1197: </a><span class="php-comment">     * @access public
</span><a href="#1198" id="1198" class="l">1198: </a><span class="php-comment">     * @return string The assembled header
</span><a href="#1199" id="1199" class="l">1199: </a><span class="php-comment">     */</span>
<a href="#1200" id="1200" class="l">1200: </a>
<a href="#1201" id="1201" class="l">1201: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> CreateHeader()
<a href="#1202" id="1202" class="l">1202: </a>    {
<a href="#1203" id="1203" class="l">1203: </a>        <span class="php-var">$result</span> = <span class="php-quote">''</span>;
<a href="#1204" id="1204" class="l">1204: </a>
<a href="#1205" id="1205" class="l">1205: </a>        <span class="php-comment">// Set the boundaries</span>
<a href="#1206" id="1206" class="l">1206: </a>        <span class="php-var">$uniq_id</span> = <span class="php-keyword2">md5</span>(<span class="php-keyword2">uniqid</span>(<span class="php-keyword2">time</span>()));
<a href="#1207" id="1207" class="l">1207: </a>        <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>] = <span class="php-quote">'b1_'</span> . <span class="php-var">$uniq_id</span>;
<a href="#1208" id="1208" class="l">1208: </a>        <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">2</span>] = <span class="php-quote">'b2_'</span> . <span class="php-var">$uniq_id</span>;
<a href="#1209" id="1209" class="l">1209: </a>
<a href="#1210" id="1210" class="l">1210: </a>        <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Date'</span>, self::RFCDate());
<a href="#1211" id="1211" class="l">1211: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;Sender == <span class="php-quote">''</span>) {
<a href="#1212" id="1212" class="l">1212: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Return-Path'</span>, <span class="php-keyword2">trim</span>(<span class="php-var">$this</span>-&gt;From));
<a href="#1213" id="1213" class="l">1213: </a>        } <span class="php-keyword1">else</span> {
<a href="#1214" id="1214" class="l">1214: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Return-Path'</span>, <span class="php-keyword2">trim</span>(<span class="php-var">$this</span>-&gt;Sender));
<a href="#1215" id="1215" class="l">1215: </a>        }
<a href="#1216" id="1216" class="l">1216: </a>
<a href="#1217" id="1217" class="l">1217: </a>        <span class="php-comment">// To be created automatically by mail()</span>
<a href="#1218" id="1218" class="l">1218: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;Mailer != <span class="php-quote">'mail'</span>) {
<a href="#1219" id="1219" class="l">1219: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;SingleTo === <span class="php-keyword1">TRUE</span>) {
<a href="#1220" id="1220" class="l">1220: </a>                <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;to <span class="php-keyword1">as</span> <span class="php-var">$t</span>) {
<a href="#1221" id="1221" class="l">1221: </a>                    <span class="php-var">$this</span>-&gt;SingleToArray[] = <span class="php-var">$this</span>-&gt;AddrFormat(<span class="php-var">$t</span>);
<a href="#1222" id="1222" class="l">1222: </a>                }
<a href="#1223" id="1223" class="l">1223: </a>            } <span class="php-keyword1">else</span> {
<a href="#1224" id="1224" class="l">1224: </a>                <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;to) &gt; <span class="php-num">0</span>) {
<a href="#1225" id="1225" class="l">1225: </a>                    <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;AddrAppend(<span class="php-quote">'To'</span>, <span class="php-var">$this</span>-&gt;to);
<a href="#1226" id="1226" class="l">1226: </a>                } <span class="php-keyword1">elseif</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;cc) == <span class="php-num">0</span>) {
<a href="#1227" id="1227" class="l">1227: </a>                    <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'To'</span>,
<a href="#1228" id="1228" class="l">1228: </a>                                    <span class="php-quote">'undisclosed-recipients:;'</span>);
<a href="#1229" id="1229" class="l">1229: </a>                }
<a href="#1230" id="1230" class="l">1230: </a>            }
<a href="#1231" id="1231" class="l">1231: </a>        }
<a href="#1232" id="1232" class="l">1232: </a>
<a href="#1233" id="1233" class="l">1233: </a>        <span class="php-var">$from</span> = <span class="php-keyword1">array</span>();
<a href="#1234" id="1234" class="l">1234: </a>        <span class="php-var">$from</span>[<span class="php-num">0</span>][<span class="php-num">0</span>] = <span class="php-keyword2">trim</span>(<span class="php-var">$this</span>-&gt;From);
<a href="#1235" id="1235" class="l">1235: </a>        <span class="php-var">$from</span>[<span class="php-num">0</span>][<span class="php-num">1</span>] = <span class="php-var">$this</span>-&gt;FromName;
<a href="#1236" id="1236" class="l">1236: </a>        <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;AddrAppend(<span class="php-quote">'From'</span>, <span class="php-var">$from</span>);
<a href="#1237" id="1237" class="l">1237: </a>
<a href="#1238" id="1238" class="l">1238: </a>        <span class="php-comment">// sendmail and mail() extract Cc from the header before sending</span>
<a href="#1239" id="1239" class="l">1239: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;cc) &gt; <span class="php-num">0</span>) {
<a href="#1240" id="1240" class="l">1240: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;AddrAppend(<span class="php-quote">'Cc'</span>, <span class="php-var">$this</span>-&gt;cc);
<a href="#1241" id="1241" class="l">1241: </a>        }
<a href="#1242" id="1242" class="l">1242: </a>
<a href="#1243" id="1243" class="l">1243: </a>        <span class="php-comment">// sendmail and mail() extract Bcc from the header before sending</span>
<a href="#1244" id="1244" class="l">1244: </a>        <span class="php-keyword1">if</span> (((<span class="php-var">$this</span>-&gt;Mailer == <span class="php-quote">'sendmail'</span>) || (<span class="php-var">$this</span>-&gt;Mailer == <span class="php-quote">'mail'</span>))
<a href="#1245" id="1245" class="l">1245: </a>                &amp;&amp; (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;bcc) &gt; <span class="php-num">0</span>)) {
<a href="#1246" id="1246" class="l">1246: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;AddrAppend(<span class="php-quote">'Bcc'</span>, <span class="php-var">$this</span>-&gt;bcc);
<a href="#1247" id="1247" class="l">1247: </a>        }
<a href="#1248" id="1248" class="l">1248: </a>
<a href="#1249" id="1249" class="l">1249: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;ReplyTo) &gt; <span class="php-num">0</span>) {
<a href="#1250" id="1250" class="l">1250: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;AddrAppend(<span class="php-quote">'Reply-to'</span>, <span class="php-var">$this</span>-&gt;ReplyTo);
<a href="#1251" id="1251" class="l">1251: </a>        }
<a href="#1252" id="1252" class="l">1252: </a>
<a href="#1253" id="1253" class="l">1253: </a>        <span class="php-comment">// mail() sets the subject itself</span>
<a href="#1254" id="1254" class="l">1254: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;Mailer != <span class="php-quote">'mail'</span>) {
<a href="#1255" id="1255" class="l">1255: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Subject'</span>,
<a href="#1256" id="1256" class="l">1256: </a>                            <span class="php-var">$this</span>-&gt;EncodeHeader(
<a href="#1257" id="1257" class="l">1257: </a>                                            <span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$this</span>-&gt;Subject)));
<a href="#1258" id="1258" class="l">1258: </a>        }
<a href="#1259" id="1259" class="l">1259: </a>
<a href="#1260" id="1260" class="l">1260: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;MessageID != <span class="php-quote">''</span>) {
<a href="#1261" id="1261" class="l">1261: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Message-ID'</span>, <span class="php-var">$this</span>-&gt;MessageID);
<a href="#1262" id="1262" class="l">1262: </a>        } <span class="php-keyword1">else</span> {
<a href="#1263" id="1263" class="l">1263: </a>            <span class="php-var">$result</span> .= <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;Message-ID: &lt;%s@%s&gt;%s&quot;</span>, <span class="php-var">$uniq_id</span>,
<a href="#1264" id="1264" class="l">1264: </a>                    <span class="php-var">$this</span>-&gt;ServerHostname(), <span class="php-var">$this</span>-&gt;LE);
<a href="#1265" id="1265" class="l">1265: </a>        }
<a href="#1266" id="1266" class="l">1266: </a>        <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'X-Priority'</span>, <span class="php-var">$this</span>-&gt;Priority);
<a href="#1267" id="1267" class="l">1267: </a>        <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'X-Mailer'</span>,
<a href="#1268" id="1268" class="l">1268: </a>                        <span class="php-quote">'PHPMailer '</span> . <span class="php-var">$this</span>-&gt;Version
<a href="#1269" id="1269" class="l">1269: </a>                                . <span class="php-quote">' (phpmailer.sourceforge.net)'</span>);
<a href="#1270" id="1270" class="l">1270: </a>
<a href="#1271" id="1271" class="l">1271: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;ConfirmReadingTo != <span class="php-quote">''</span>) {
<a href="#1272" id="1272" class="l">1272: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Disposition-Notification-To'</span>,
<a href="#1273" id="1273" class="l">1273: </a>                            <span class="php-quote">'&lt;'</span> . <span class="php-keyword2">trim</span>(<span class="php-var">$this</span>-&gt;ConfirmReadingTo) . <span class="php-quote">'&gt;'</span>);
<a href="#1274" id="1274" class="l">1274: </a>        }
<a href="#1275" id="1275" class="l">1275: </a>
<a href="#1276" id="1276" class="l">1276: </a>        <span class="php-comment">// Add custom headers</span>
<a href="#1277" id="1277" class="l">1277: </a>        <span class="php-keyword1">for</span> (<span class="php-var">$index</span> = <span class="php-num">0</span>; <span class="php-var">$index</span> &lt; <span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;CustomHeader); <span class="php-var">$index</span>++) {
<a href="#1278" id="1278" class="l">1278: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-keyword2">trim</span>(<span class="php-var">$this</span>-&gt;CustomHeader[<span class="php-var">$index</span>][<span class="php-num">0</span>]),
<a href="#1279" id="1279" class="l">1279: </a>                            <span class="php-var">$this</span>-&gt;EncodeHeader(
<a href="#1280" id="1280" class="l">1280: </a>                                            <span class="php-keyword2">trim</span>(<span class="php-var">$this</span>-&gt;CustomHeader[<span class="php-var">$index</span>][<span class="php-num">1</span>])));
<a href="#1281" id="1281" class="l">1281: </a>        }
<a href="#1282" id="1282" class="l">1282: </a>        <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;sign_key_file) {
<a href="#1283" id="1283" class="l">1283: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'MIME-Version'</span>, <span class="php-quote">'1.0'</span>);
<a href="#1284" id="1284" class="l">1284: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;GetMailMIME();
<a href="#1285" id="1285" class="l">1285: </a>        }
<a href="#1286" id="1286" class="l">1286: </a>
<a href="#1287" id="1287" class="l">1287: </a>        <span class="php-keyword1">return</span> <span class="php-var">$result</span>;
<a href="#1288" id="1288" class="l">1288: </a>    }
<a href="#1289" id="1289" class="l">1289: </a>
<a href="#1290" id="1290" class="l">1290: </a>    <span class="php-comment">/**
</span><a href="#1291" id="1291" class="l">1291: </a><span class="php-comment">     * Returns the message MIME.
</span><a href="#1292" id="1292" class="l">1292: </a><span class="php-comment">     * @access public
</span><a href="#1293" id="1293" class="l">1293: </a><span class="php-comment">     * @return string
</span><a href="#1294" id="1294" class="l">1294: </a><span class="php-comment">     */</span>
<a href="#1295" id="1295" class="l">1295: </a>
<a href="#1296" id="1296" class="l">1296: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> GetMailMIME()
<a href="#1297" id="1297" class="l">1297: </a>    {
<a href="#1298" id="1298" class="l">1298: </a>        <span class="php-var">$result</span> = <span class="php-quote">''</span>;
<a href="#1299" id="1299" class="l">1299: </a>        <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>-&gt;message_type) {
<a href="#1300" id="1300" class="l">1300: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'plain'</span>:
<a href="#1301" id="1301" class="l">1301: </a>                <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Content-Transfer-Encoding'</span>,
<a href="#1302" id="1302" class="l">1302: </a>                                <span class="php-var">$this</span>-&gt;Encoding);
<a href="#1303" id="1303" class="l">1303: </a>                <span class="php-var">$result</span> .= <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;Content-Type: %s; charset=\&quot;%s\&quot;&quot;</span>,
<a href="#1304" id="1304" class="l">1304: </a>                        <span class="php-var">$this</span>-&gt;ContentType, <span class="php-var">$this</span>-&gt;CharSet);
<a href="#1305" id="1305" class="l">1305: </a>                <span class="php-keyword1">break</span>;
<a href="#1306" id="1306" class="l">1306: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'attachments'</span>:
<a href="#1307" id="1307" class="l">1307: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'alt_attachments'</span>:
<a href="#1308" id="1308" class="l">1308: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;InlineImageExists()) {
<a href="#1309" id="1309" class="l">1309: </a>                    <span class="php-var">$result</span> .= <span class="php-keyword2">sprintf</span>(
<a href="#1310" id="1310" class="l">1310: </a>                            <span class="php-quote">&quot;Content-Type: %s;%s\ttype=\&quot;text/html\&quot;;%s\tboundary=\&quot;%s\&quot;%s&quot;</span>,
<a href="#1311" id="1311" class="l">1311: </a>                            <span class="php-quote">'multipart/related'</span>, <span class="php-var">$this</span>-&gt;LE, <span class="php-var">$this</span>-&gt;LE,
<a href="#1312" id="1312" class="l">1312: </a>                            <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>], <span class="php-var">$this</span>-&gt;LE);
<a href="#1313" id="1313" class="l">1313: </a>                } <span class="php-keyword1">else</span> {
<a href="#1314" id="1314" class="l">1314: </a>                    <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Content-Type'</span>,
<a href="#1315" id="1315" class="l">1315: </a>                                    <span class="php-quote">'multipart/mixed;'</span>);
<a href="#1316" id="1316" class="l">1316: </a>                    <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;TextLine(
<a href="#1317" id="1317" class="l">1317: </a>                                    <span class="php-quote">&quot;\tboundary=\&quot;&quot;</span> . <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>] . <span class="php-quote">'&quot;'</span>);
<a href="#1318" id="1318" class="l">1318: </a>                }
<a href="#1319" id="1319" class="l">1319: </a>                <span class="php-keyword1">break</span>;
<a href="#1320" id="1320" class="l">1320: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'alt'</span>:
<a href="#1321" id="1321" class="l">1321: </a>                <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Content-Type'</span>,
<a href="#1322" id="1322" class="l">1322: </a>                                <span class="php-quote">'multipart/alternative;'</span>);
<a href="#1323" id="1323" class="l">1323: </a>                <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;TextLine(
<a href="#1324" id="1324" class="l">1324: </a>                                <span class="php-quote">&quot;\tboundary=\&quot;&quot;</span> . <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>] . <span class="php-quote">'&quot;'</span>);
<a href="#1325" id="1325" class="l">1325: </a>                <span class="php-keyword1">break</span>;
<a href="#1326" id="1326" class="l">1326: </a>        }
<a href="#1327" id="1327" class="l">1327: </a>
<a href="#1328" id="1328" class="l">1328: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;Mailer != <span class="php-quote">'mail'</span>) {
<a href="#1329" id="1329" class="l">1329: </a>            <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE;
<a href="#1330" id="1330" class="l">1330: </a>        }
<a href="#1331" id="1331" class="l">1331: </a>
<a href="#1332" id="1332" class="l">1332: </a>        <span class="php-keyword1">return</span> <span class="php-var">$result</span>;
<a href="#1333" id="1333" class="l">1333: </a>    }
<a href="#1334" id="1334" class="l">1334: </a>
<a href="#1335" id="1335" class="l">1335: </a>    <span class="php-comment">/**
</span><a href="#1336" id="1336" class="l">1336: </a><span class="php-comment">     * Assembles the message body.  Returns an empty string on failure.
</span><a href="#1337" id="1337" class="l">1337: </a><span class="php-comment">     * @access public
</span><a href="#1338" id="1338" class="l">1338: </a><span class="php-comment">     * @return string The assembled message body
</span><a href="#1339" id="1339" class="l">1339: </a><span class="php-comment">     */</span>
<a href="#1340" id="1340" class="l">1340: </a>
<a href="#1341" id="1341" class="l">1341: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> CreateBody()
<a href="#1342" id="1342" class="l">1342: </a>    {
<a href="#1343" id="1343" class="l">1343: </a>        <span class="php-var">$body</span> = <span class="php-quote">''</span>;
<a href="#1344" id="1344" class="l">1344: </a>
<a href="#1345" id="1345" class="l">1345: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;sign_key_file) {
<a href="#1346" id="1346" class="l">1346: </a>            <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;GetMailMIME();
<a href="#1347" id="1347" class="l">1347: </a>        }
<a href="#1348" id="1348" class="l">1348: </a>
<a href="#1349" id="1349" class="l">1349: </a>        <span class="php-var">$this</span>-&gt;SetWordWrap();
<a href="#1350" id="1350" class="l">1350: </a>
<a href="#1351" id="1351" class="l">1351: </a>        <span class="php-keyword1">switch</span> (<span class="php-var">$this</span>-&gt;message_type) {
<a href="#1352" id="1352" class="l">1352: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'alt'</span>:
<a href="#1353" id="1353" class="l">1353: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;GetBoundary(<span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>], <span class="php-quote">''</span>,
<a href="#1354" id="1354" class="l">1354: </a>                                <span class="php-quote">'text/plain'</span>, <span class="php-quote">''</span>);
<a href="#1355" id="1355" class="l">1355: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;EncodeString(<span class="php-var">$this</span>-&gt;AltBody, <span class="php-var">$this</span>-&gt;Encoding);
<a href="#1356" id="1356" class="l">1356: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE;
<a href="#1357" id="1357" class="l">1357: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;GetBoundary(<span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>], <span class="php-quote">''</span>,
<a href="#1358" id="1358" class="l">1358: </a>                                <span class="php-quote">'text/html'</span>, <span class="php-quote">''</span>);
<a href="#1359" id="1359" class="l">1359: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;EncodeString(<span class="php-var">$this</span>-&gt;Body, <span class="php-var">$this</span>-&gt;Encoding);
<a href="#1360" id="1360" class="l">1360: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE;
<a href="#1361" id="1361" class="l">1361: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;EndBoundary(<span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>]);
<a href="#1362" id="1362" class="l">1362: </a>                <span class="php-keyword1">break</span>;
<a href="#1363" id="1363" class="l">1363: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'plain'</span>:
<a href="#1364" id="1364" class="l">1364: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;EncodeString(<span class="php-var">$this</span>-&gt;Body, <span class="php-var">$this</span>-&gt;Encoding);
<a href="#1365" id="1365" class="l">1365: </a>                <span class="php-keyword1">break</span>;
<a href="#1366" id="1366" class="l">1366: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'attachments'</span>:
<a href="#1367" id="1367" class="l">1367: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;GetBoundary(<span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>], <span class="php-quote">''</span>, <span class="php-quote">''</span>, <span class="php-quote">''</span>);
<a href="#1368" id="1368" class="l">1368: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;EncodeString(<span class="php-var">$this</span>-&gt;Body, <span class="php-var">$this</span>-&gt;Encoding);
<a href="#1369" id="1369" class="l">1369: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;LE;
<a href="#1370" id="1370" class="l">1370: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;AttachAll();
<a href="#1371" id="1371" class="l">1371: </a>                <span class="php-keyword1">break</span>;
<a href="#1372" id="1372" class="l">1372: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'alt_attachments'</span>:
<a href="#1373" id="1373" class="l">1373: </a>                <span class="php-var">$body</span> .= <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;--%s%s&quot;</span>, <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>], <span class="php-var">$this</span>-&gt;LE);
<a href="#1374" id="1374" class="l">1374: </a>                <span class="php-var">$body</span> .= <span class="php-keyword2">sprintf</span>(
<a href="#1375" id="1375" class="l">1375: </a>                        <span class="php-quote">&quot;Content-Type: %s;%s&quot;</span> . <span class="php-quote">&quot;\tboundary=\&quot;%s\&quot;%s&quot;</span>,
<a href="#1376" id="1376" class="l">1376: </a>                        <span class="php-quote">'multipart/alternative'</span>, <span class="php-var">$this</span>-&gt;LE, <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">2</span>],
<a href="#1377" id="1377" class="l">1377: </a>                        <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE);
<a href="#1378" id="1378" class="l">1378: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;GetBoundary(<span class="php-var">$this</span>-&gt;boundary[<span class="php-num">2</span>], <span class="php-quote">''</span>,
<a href="#1379" id="1379" class="l">1379: </a>                                <span class="php-quote">'text/plain'</span>, <span class="php-quote">''</span>) . <span class="php-var">$this</span>-&gt;LE; <span class="php-comment">// Create text body</span>
<a href="#1380" id="1380" class="l">1380: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;EncodeString(<span class="php-var">$this</span>-&gt;AltBody, <span class="php-var">$this</span>-&gt;Encoding);
<a href="#1381" id="1381" class="l">1381: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE;
<a href="#1382" id="1382" class="l">1382: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;GetBoundary(<span class="php-var">$this</span>-&gt;boundary[<span class="php-num">2</span>], <span class="php-quote">''</span>,
<a href="#1383" id="1383" class="l">1383: </a>                                <span class="php-quote">'text/html'</span>, <span class="php-quote">''</span>) . <span class="php-var">$this</span>-&gt;LE; <span class="php-comment">// Create the HTML body</span>
<a href="#1384" id="1384" class="l">1384: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;EncodeString(<span class="php-var">$this</span>-&gt;Body, <span class="php-var">$this</span>-&gt;Encoding);
<a href="#1385" id="1385" class="l">1385: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE;
<a href="#1386" id="1386" class="l">1386: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;EndBoundary(<span class="php-var">$this</span>-&gt;boundary[<span class="php-num">2</span>]);
<a href="#1387" id="1387" class="l">1387: </a>                <span class="php-var">$body</span> .= <span class="php-var">$this</span>-&gt;AttachAll();
<a href="#1388" id="1388" class="l">1388: </a>                <span class="php-keyword1">break</span>;
<a href="#1389" id="1389" class="l">1389: </a>        }
<a href="#1390" id="1390" class="l">1390: </a>
<a href="#1391" id="1391" class="l">1391: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;IsError()) {
<a href="#1392" id="1392" class="l">1392: </a>            <span class="php-var">$body</span> = <span class="php-quote">''</span>;
<a href="#1393" id="1393" class="l">1393: </a>        } <span class="php-keyword1">elseif</span> (<span class="php-var">$this</span>-&gt;sign_key_file) {
<a href="#1394" id="1394" class="l">1394: </a>            <span class="php-keyword1">try</span> {
<a href="#1395" id="1395" class="l">1395: </a>                <span class="php-var">$file</span> = <span class="php-keyword2">tempnam</span>(<span class="php-quote">''</span>, <span class="php-quote">'mail'</span>);
<a href="#1396" id="1396" class="l">1396: </a>                <span class="php-keyword2">file_put_contents</span>(<span class="php-var">$file</span>, <span class="php-var">$body</span>); <span class="php-comment">//TODO check this worked</span>
<a href="#1397" id="1397" class="l">1397: </a>                <span class="php-var">$signed</span> = <span class="php-keyword2">tempnam</span>(<span class="php-quote">&quot;&quot;</span>, <span class="php-quote">&quot;signed&quot;</span>);
<a href="#1398" id="1398" class="l">1398: </a>                <span class="php-keyword1">if</span> (@<span class="php-keyword2">openssl_pkcs7_sign</span>(<span class="php-var">$file</span>, <span class="php-var">$signed</span>,
<a href="#1399" id="1399" class="l">1399: </a>                        <span class="php-quote">&quot;file://&quot;</span> . <span class="php-var">$this</span>-&gt;sign_cert_file,
<a href="#1400" id="1400" class="l">1400: </a>                        <span class="php-keyword1">array</span>(
<a href="#1401" id="1401" class="l">1401: </a>                                <span class="php-quote">&quot;file://&quot;</span> . <span class="php-var">$this</span>-&gt;sign_key_file,
<a href="#1402" id="1402" class="l">1402: </a>                                <span class="php-var">$this</span>-&gt;sign_key_pass
<a href="#1403" id="1403" class="l">1403: </a>                        ), <span class="php-keyword1">NULL</span>)) {
<a href="#1404" id="1404" class="l">1404: </a>                    @<span class="php-keyword2">unlink</span>(<span class="php-var">$file</span>);
<a href="#1405" id="1405" class="l">1405: </a>                    @<span class="php-keyword2">unlink</span>(<span class="php-var">$signed</span>);
<a href="#1406" id="1406" class="l">1406: </a>                    <span class="php-var">$body</span> = <span class="php-keyword2">file_get_contents</span>(<span class="php-var">$signed</span>);
<a href="#1407" id="1407" class="l">1407: </a>                } <span class="php-keyword1">else</span> {
<a href="#1408" id="1408" class="l">1408: </a>                    @<span class="php-keyword2">unlink</span>(<span class="php-var">$file</span>);
<a href="#1409" id="1409" class="l">1409: </a>                    @<span class="php-keyword2">unlink</span>(<span class="php-var">$signed</span>);
<a href="#1410" id="1410" class="l">1410: </a>                    <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#1411" id="1411" class="l">1411: </a>                            <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">&quot;signing&quot;</span>) . <span class="php-keyword2">openssl_error_string</span>());
<a href="#1412" id="1412" class="l">1412: </a>                }
<a href="#1413" id="1413" class="l">1413: </a>            } <span class="php-keyword1">catch</span> (phpmailerException <span class="php-var">$e</span>) {
<a href="#1414" id="1414" class="l">1414: </a>                <span class="php-var">$body</span> = <span class="php-quote">''</span>;
<a href="#1415" id="1415" class="l">1415: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;exceptions) {
<a href="#1416" id="1416" class="l">1416: </a>                    <span class="php-keyword1">throw</span> <span class="php-var">$e</span>;
<a href="#1417" id="1417" class="l">1417: </a>                }
<a href="#1418" id="1418" class="l">1418: </a>            }
<a href="#1419" id="1419" class="l">1419: </a>        }
<a href="#1420" id="1420" class="l">1420: </a>
<a href="#1421" id="1421" class="l">1421: </a>        <span class="php-keyword1">return</span> <span class="php-var">$body</span>;
<a href="#1422" id="1422" class="l">1422: </a>    }
<a href="#1423" id="1423" class="l">1423: </a>
<a href="#1424" id="1424" class="l">1424: </a>    <span class="php-comment">/**
</span><a href="#1425" id="1425" class="l">1425: </a><span class="php-comment">     * Returns the start of a message boundary.
</span><a href="#1426" id="1426" class="l">1426: </a><span class="php-comment">     * @access private
</span><a href="#1427" id="1427" class="l">1427: </a><span class="php-comment">     */</span>
<a href="#1428" id="1428" class="l">1428: </a>
<a href="#1429" id="1429" class="l">1429: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> GetBoundary(<span class="php-var">$boundary</span>, <span class="php-var">$charSet</span>, <span class="php-var">$contentType</span>, <span class="php-var">$encoding</span>)
<a href="#1430" id="1430" class="l">1430: </a>    {
<a href="#1431" id="1431" class="l">1431: </a>        <span class="php-var">$result</span> = <span class="php-quote">''</span>;
<a href="#1432" id="1432" class="l">1432: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$charSet</span> == <span class="php-quote">''</span>) {
<a href="#1433" id="1433" class="l">1433: </a>            <span class="php-var">$charSet</span> = <span class="php-var">$this</span>-&gt;CharSet;
<a href="#1434" id="1434" class="l">1434: </a>        }
<a href="#1435" id="1435" class="l">1435: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$contentType</span> == <span class="php-quote">''</span>) {
<a href="#1436" id="1436" class="l">1436: </a>            <span class="php-var">$contentType</span> = <span class="php-var">$this</span>-&gt;ContentType;
<a href="#1437" id="1437" class="l">1437: </a>        }
<a href="#1438" id="1438" class="l">1438: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$encoding</span> == <span class="php-quote">''</span>) {
<a href="#1439" id="1439" class="l">1439: </a>            <span class="php-var">$encoding</span> = <span class="php-var">$this</span>-&gt;Encoding;
<a href="#1440" id="1440" class="l">1440: </a>        }
<a href="#1441" id="1441" class="l">1441: </a>        <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;TextLine(<span class="php-quote">'--'</span> . <span class="php-var">$boundary</span>);
<a href="#1442" id="1442" class="l">1442: </a>        <span class="php-var">$result</span> .= <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;Content-Type: %s; charset = \&quot;%s\&quot;&quot;</span>, <span class="php-var">$contentType</span>,
<a href="#1443" id="1443" class="l">1443: </a>                <span class="php-var">$charSet</span>);
<a href="#1444" id="1444" class="l">1444: </a>        <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;LE;
<a href="#1445" id="1445" class="l">1445: </a>        <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;HeaderLine(<span class="php-quote">'Content-Transfer-Encoding'</span>, <span class="php-var">$encoding</span>);
<a href="#1446" id="1446" class="l">1446: </a>        <span class="php-var">$result</span> .= <span class="php-var">$this</span>-&gt;LE;
<a href="#1447" id="1447" class="l">1447: </a>
<a href="#1448" id="1448" class="l">1448: </a>        <span class="php-keyword1">return</span> <span class="php-var">$result</span>;
<a href="#1449" id="1449" class="l">1449: </a>    }
<a href="#1450" id="1450" class="l">1450: </a>
<a href="#1451" id="1451" class="l">1451: </a>    <span class="php-comment">/**
</span><a href="#1452" id="1452" class="l">1452: </a><span class="php-comment">     * Returns the end of a message boundary.
</span><a href="#1453" id="1453" class="l">1453: </a><span class="php-comment">     * @access private
</span><a href="#1454" id="1454" class="l">1454: </a><span class="php-comment">     */</span>
<a href="#1455" id="1455" class="l">1455: </a>
<a href="#1456" id="1456" class="l">1456: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> EndBoundary(<span class="php-var">$boundary</span>)
<a href="#1457" id="1457" class="l">1457: </a>    {
<a href="#1458" id="1458" class="l">1458: </a>        <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;LE . <span class="php-quote">'--'</span> . <span class="php-var">$boundary</span> . <span class="php-quote">'--'</span> . <span class="php-var">$this</span>-&gt;LE;
<a href="#1459" id="1459" class="l">1459: </a>    }
<a href="#1460" id="1460" class="l">1460: </a>
<a href="#1461" id="1461" class="l">1461: </a>    <span class="php-comment">/**
</span><a href="#1462" id="1462" class="l">1462: </a><span class="php-comment">     * Sets the message type.
</span><a href="#1463" id="1463" class="l">1463: </a><span class="php-comment">     * @access private
</span><a href="#1464" id="1464" class="l">1464: </a><span class="php-comment">     * @return void
</span><a href="#1465" id="1465" class="l">1465: </a><span class="php-comment">     */</span>
<a href="#1466" id="1466" class="l">1466: </a>
<a href="#1467" id="1467" class="l">1467: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> SetMessageType()
<a href="#1468" id="1468" class="l">1468: </a>    {
<a href="#1469" id="1469" class="l">1469: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;attachment) &lt; <span class="php-num">1</span> &amp;&amp; <span class="php-keyword2">strlen</span>(<span class="php-var">$this</span>-&gt;AltBody) &lt; <span class="php-num">1</span>) {
<a href="#1470" id="1470" class="l">1470: </a>            <span class="php-var">$this</span>-&gt;message_type = <span class="php-quote">'plain'</span>;
<a href="#1471" id="1471" class="l">1471: </a>        } <span class="php-keyword1">else</span> {
<a href="#1472" id="1472" class="l">1472: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;attachment) &gt; <span class="php-num">0</span>) {
<a href="#1473" id="1473" class="l">1473: </a>                <span class="php-var">$this</span>-&gt;message_type = <span class="php-quote">'attachments'</span>;
<a href="#1474" id="1474" class="l">1474: </a>            }
<a href="#1475" id="1475" class="l">1475: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$this</span>-&gt;AltBody) &gt; <span class="php-num">0</span> &amp;&amp; <span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;attachment) &lt; <span class="php-num">1</span>) {
<a href="#1476" id="1476" class="l">1476: </a>                <span class="php-var">$this</span>-&gt;message_type = <span class="php-quote">'alt'</span>;
<a href="#1477" id="1477" class="l">1477: </a>            }
<a href="#1478" id="1478" class="l">1478: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$this</span>-&gt;AltBody) &gt; <span class="php-num">0</span> &amp;&amp; <span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;attachment) &gt; <span class="php-num">0</span>) {
<a href="#1479" id="1479" class="l">1479: </a>                <span class="php-var">$this</span>-&gt;message_type = <span class="php-quote">'alt_attachments'</span>;
<a href="#1480" id="1480" class="l">1480: </a>            }
<a href="#1481" id="1481" class="l">1481: </a>        }
<a href="#1482" id="1482" class="l">1482: </a>    }
<a href="#1483" id="1483" class="l">1483: </a>
<a href="#1484" id="1484" class="l">1484: </a>    <span class="php-comment">/**
</span><a href="#1485" id="1485" class="l">1485: </a><span class="php-comment">     *  Returns a formatted header line.
</span><a href="#1486" id="1486" class="l">1486: </a><span class="php-comment">     * @access public
</span><a href="#1487" id="1487" class="l">1487: </a><span class="php-comment">     * @return string
</span><a href="#1488" id="1488" class="l">1488: </a><span class="php-comment">     */</span>
<a href="#1489" id="1489" class="l">1489: </a>
<a href="#1490" id="1490" class="l">1490: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> HeaderLine(<span class="php-var">$name</span>, <span class="php-var">$value</span>)
<a href="#1491" id="1491" class="l">1491: </a>    {
<a href="#1492" id="1492" class="l">1492: </a>        <span class="php-keyword1">return</span> <span class="php-var">$name</span> . <span class="php-quote">': '</span> . <span class="php-var">$value</span> . <span class="php-var">$this</span>-&gt;LE;
<a href="#1493" id="1493" class="l">1493: </a>    }
<a href="#1494" id="1494" class="l">1494: </a>
<a href="#1495" id="1495" class="l">1495: </a>    <span class="php-comment">/**
</span><a href="#1496" id="1496" class="l">1496: </a><span class="php-comment">     * Returns a formatted mail line.
</span><a href="#1497" id="1497" class="l">1497: </a><span class="php-comment">     * @access public
</span><a href="#1498" id="1498" class="l">1498: </a><span class="php-comment">     * @return string
</span><a href="#1499" id="1499" class="l">1499: </a><span class="php-comment">     */</span>
<a href="#1500" id="1500" class="l">1500: </a>
<a href="#1501" id="1501" class="l">1501: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> TextLine(<span class="php-var">$value</span>)
<a href="#1502" id="1502" class="l">1502: </a>    {
<a href="#1503" id="1503" class="l">1503: </a>        <span class="php-keyword1">return</span> <span class="php-var">$value</span> . <span class="php-var">$this</span>-&gt;LE;
<a href="#1504" id="1504" class="l">1504: </a>    }
<a href="#1505" id="1505" class="l">1505: </a>
<a href="#1506" id="1506" class="l">1506: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#1507" id="1507" class="l">1507: </a>    <span class="php-comment">// CLASS METHODS, ATTACHMENTS</span>
<a href="#1508" id="1508" class="l">1508: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#1509" id="1509" class="l">1509: </a>
<a href="#1510" id="1510" class="l">1510: </a>    <span class="php-comment">/**
</span><a href="#1511" id="1511" class="l">1511: </a><span class="php-comment">     * Adds an attachment from a path on the filesystem.
</span><a href="#1512" id="1512" class="l">1512: </a><span class="php-comment">     * Returns FALSE if the file could not be found
</span><a href="#1513" id="1513" class="l">1513: </a><span class="php-comment">     * or accessed.
</span><a href="#1514" id="1514" class="l">1514: </a><span class="php-comment">     * @param string $path Path to the attachment.
</span><a href="#1515" id="1515" class="l">1515: </a><span class="php-comment">     * @param string $name Overrides the attachment name.
</span><a href="#1516" id="1516" class="l">1516: </a><span class="php-comment">     * @param string $encoding File encoding (see $Encoding).
</span><a href="#1517" id="1517" class="l">1517: </a><span class="php-comment">     * @param string $type File extension (MIME) type.
</span><a href="#1518" id="1518" class="l">1518: </a><span class="php-comment">     * @return bool
</span><a href="#1519" id="1519" class="l">1519: </a><span class="php-comment">     */</span>
<a href="#1520" id="1520" class="l">1520: </a>
<a href="#1521" id="1521" class="l">1521: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddAttachment(<span class="php-var">$path</span>, <span class="php-var">$name</span> = <span class="php-quote">''</span>, <span class="php-var">$encoding</span> = <span class="php-quote">'base64'</span>,
<a href="#1522" id="1522" class="l">1522: </a>            <span class="php-var">$type</span> = <span class="php-quote">'application/octet-stream'</span>)
<a href="#1523" id="1523" class="l">1523: </a>    {
<a href="#1524" id="1524" class="l">1524: </a>        <span class="php-keyword1">try</span> {
<a href="#1525" id="1525" class="l">1525: </a>            <span class="php-keyword1">if</span> (!@<span class="php-keyword2">is_file</span>(<span class="php-var">$path</span>)) {
<a href="#1526" id="1526" class="l">1526: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#1527" id="1527" class="l">1527: </a>                        <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'file_access'</span>) . <span class="php-var">$path</span>,
<a href="#1528" id="1528" class="l">1528: </a>                        self::STOP_CONTINUE);
<a href="#1529" id="1529" class="l">1529: </a>            }
<a href="#1530" id="1530" class="l">1530: </a>            <span class="php-var">$filename</span> = <span class="php-keyword2">basename</span>(<span class="php-var">$path</span>);
<a href="#1531" id="1531" class="l">1531: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$name</span> == <span class="php-quote">''</span>) {
<a href="#1532" id="1532" class="l">1532: </a>                <span class="php-var">$name</span> = <span class="php-var">$filename</span>;
<a href="#1533" id="1533" class="l">1533: </a>            }
<a href="#1534" id="1534" class="l">1534: </a>
<a href="#1535" id="1535" class="l">1535: </a>            <span class="php-var">$this</span>-&gt;attachment[] = <span class="php-keyword1">array</span>(
<a href="#1536" id="1536" class="l">1536: </a>                    <span class="php-num">0</span> =&gt; <span class="php-var">$path</span>,
<a href="#1537" id="1537" class="l">1537: </a>                    <span class="php-num">1</span> =&gt; <span class="php-var">$filename</span>,
<a href="#1538" id="1538" class="l">1538: </a>                    <span class="php-num">2</span> =&gt; <span class="php-var">$name</span>,
<a href="#1539" id="1539" class="l">1539: </a>                    <span class="php-num">3</span> =&gt; <span class="php-var">$encoding</span>,
<a href="#1540" id="1540" class="l">1540: </a>                    <span class="php-num">4</span> =&gt; <span class="php-var">$type</span>,
<a href="#1541" id="1541" class="l">1541: </a>                    <span class="php-num">5</span> =&gt; <span class="php-keyword1">FALSE</span>,
<a href="#1542" id="1542" class="l">1542: </a>                    <span class="php-comment">// isStringAttachment</span>
<a href="#1543" id="1543" class="l">1543: </a>                    <span class="php-num">6</span> =&gt; <span class="php-quote">'attachment'</span>,
<a href="#1544" id="1544" class="l">1544: </a>                    <span class="php-num">7</span> =&gt; <span class="php-num">0</span>
<a href="#1545" id="1545" class="l">1545: </a>            );
<a href="#1546" id="1546" class="l">1546: </a>
<a href="#1547" id="1547" class="l">1547: </a>        } <span class="php-keyword1">catch</span> (phpmailerException <span class="php-var">$e</span>) {
<a href="#1548" id="1548" class="l">1548: </a>            <span class="php-var">$this</span>-&gt;SetError(<span class="php-var">$e</span>-&gt;getMessage());
<a href="#1549" id="1549" class="l">1549: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;exceptions) {
<a href="#1550" id="1550" class="l">1550: </a>                <span class="php-keyword1">throw</span> <span class="php-var">$e</span>;
<a href="#1551" id="1551" class="l">1551: </a>            }
<a href="#1552" id="1552" class="l">1552: </a>            <span class="php-keyword1">echo</span> <span class="php-var">$e</span>-&gt;getMessage() . <span class="php-quote">&quot;\n&quot;</span>;
<a href="#1553" id="1553" class="l">1553: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$e</span>-&gt;getCode() == self::STOP_CRITICAL) {
<a href="#1554" id="1554" class="l">1554: </a>                <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#1555" id="1555" class="l">1555: </a>            }
<a href="#1556" id="1556" class="l">1556: </a>        }
<a href="#1557" id="1557" class="l">1557: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#1558" id="1558" class="l">1558: </a>    }
<a href="#1559" id="1559" class="l">1559: </a>
<a href="#1560" id="1560" class="l">1560: </a>    <span class="php-comment">/**
</span><a href="#1561" id="1561" class="l">1561: </a><span class="php-comment">     * Return the current array of attachments
</span><a href="#1562" id="1562" class="l">1562: </a><span class="php-comment">     * @return array
</span><a href="#1563" id="1563" class="l">1563: </a><span class="php-comment">     */</span>
<a href="#1564" id="1564" class="l">1564: </a>
<a href="#1565" id="1565" class="l">1565: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> GetAttachments()
<a href="#1566" id="1566" class="l">1566: </a>    {
<a href="#1567" id="1567" class="l">1567: </a>        <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;attachment;
<a href="#1568" id="1568" class="l">1568: </a>    }
<a href="#1569" id="1569" class="l">1569: </a>
<a href="#1570" id="1570" class="l">1570: </a>    <span class="php-comment">/**
</span><a href="#1571" id="1571" class="l">1571: </a><span class="php-comment">     * Attaches all fs, string, and binary attachments to the message.
</span><a href="#1572" id="1572" class="l">1572: </a><span class="php-comment">     * Returns an empty string on failure.
</span><a href="#1573" id="1573" class="l">1573: </a><span class="php-comment">     * @access private
</span><a href="#1574" id="1574" class="l">1574: </a><span class="php-comment">     * @return string
</span><a href="#1575" id="1575" class="l">1575: </a><span class="php-comment">     */</span>
<a href="#1576" id="1576" class="l">1576: </a>
<a href="#1577" id="1577" class="l">1577: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> AttachAll()
<a href="#1578" id="1578" class="l">1578: </a>    {
<a href="#1579" id="1579" class="l">1579: </a>        <span class="php-comment">// Return text of body</span>
<a href="#1580" id="1580" class="l">1580: </a>        <span class="php-var">$mime</span> = <span class="php-keyword1">array</span>();
<a href="#1581" id="1581" class="l">1581: </a>        <span class="php-var">$cidUniq</span> = <span class="php-keyword1">array</span>();
<a href="#1582" id="1582" class="l">1582: </a>        <span class="php-var">$incl</span> = <span class="php-keyword1">array</span>();
<a href="#1583" id="1583" class="l">1583: </a>
<a href="#1584" id="1584" class="l">1584: </a>        <span class="php-comment">// Add all attachments</span>
<a href="#1585" id="1585" class="l">1585: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;attachment <span class="php-keyword1">as</span> <span class="php-var">$attachment</span>) {
<a href="#1586" id="1586" class="l">1586: </a>            <span class="php-comment">// Check for string attachment</span>
<a href="#1587" id="1587" class="l">1587: </a>            <span class="php-var">$bString</span> = <span class="php-var">$attachment</span>[<span class="php-num">5</span>];
<a href="#1588" id="1588" class="l">1588: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$bString</span>) {
<a href="#1589" id="1589" class="l">1589: </a>                <span class="php-var">$string</span> = <span class="php-var">$attachment</span>[<span class="php-num">0</span>];
<a href="#1590" id="1590" class="l">1590: </a>            } <span class="php-keyword1">else</span> {
<a href="#1591" id="1591" class="l">1591: </a>                <span class="php-var">$path</span> = <span class="php-var">$attachment</span>[<span class="php-num">0</span>];
<a href="#1592" id="1592" class="l">1592: </a>            }
<a href="#1593" id="1593" class="l">1593: </a>
<a href="#1594" id="1594" class="l">1594: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword2">in_array</span>(<span class="php-var">$attachment</span>[<span class="php-num">0</span>], <span class="php-var">$incl</span>)) {
<a href="#1595" id="1595" class="l">1595: </a>                <span class="php-keyword1">continue</span>;
<a href="#1596" id="1596" class="l">1596: </a>            }
<a href="#1597" id="1597" class="l">1597: </a>            <span class="php-var">$filename</span> = <span class="php-var">$attachment</span>[<span class="php-num">1</span>];
<a href="#1598" id="1598" class="l">1598: </a>            <span class="php-var">$name</span> = <span class="php-var">$attachment</span>[<span class="php-num">2</span>];
<a href="#1599" id="1599" class="l">1599: </a>            <span class="php-var">$encoding</span> = <span class="php-var">$attachment</span>[<span class="php-num">3</span>];
<a href="#1600" id="1600" class="l">1600: </a>            <span class="php-var">$type</span> = <span class="php-var">$attachment</span>[<span class="php-num">4</span>];
<a href="#1601" id="1601" class="l">1601: </a>            <span class="php-var">$disposition</span> = <span class="php-var">$attachment</span>[<span class="php-num">6</span>];
<a href="#1602" id="1602" class="l">1602: </a>            <span class="php-var">$cid</span> = <span class="php-var">$attachment</span>[<span class="php-num">7</span>];
<a href="#1603" id="1603" class="l">1603: </a>            <span class="php-var">$incl</span>[] = <span class="php-var">$attachment</span>[<span class="php-num">0</span>];
<a href="#1604" id="1604" class="l">1604: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$disposition</span> == <span class="php-quote">'inline'</span> &amp;&amp; <span class="php-keyword1">isset</span>(<span class="php-var">$cidUniq</span>[<span class="php-var">$cid</span>])) {
<a href="#1605" id="1605" class="l">1605: </a>                <span class="php-keyword1">continue</span>;
<a href="#1606" id="1606" class="l">1606: </a>            }
<a href="#1607" id="1607" class="l">1607: </a>            <span class="php-var">$cidUniq</span>[<span class="php-var">$cid</span>] = <span class="php-keyword1">TRUE</span>;
<a href="#1608" id="1608" class="l">1608: </a>
<a href="#1609" id="1609" class="l">1609: </a>            <span class="php-var">$mime</span>[] = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;--%s%s&quot;</span>, <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>], <span class="php-var">$this</span>-&gt;LE);
<a href="#1610" id="1610" class="l">1610: </a>            <span class="php-var">$mime</span>[] = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;Content-Type: %s; name=\&quot;%s\&quot;%s&quot;</span>, <span class="php-var">$type</span>,
<a href="#1611" id="1611" class="l">1611: </a>                    <span class="php-var">$this</span>-&gt;EncodeHeader(<span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$name</span>)), <span class="php-var">$this</span>-&gt;LE);
<a href="#1612" id="1612" class="l">1612: </a>            <span class="php-var">$mime</span>[] = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;Content-Transfer-Encoding: %s%s&quot;</span>, <span class="php-var">$encoding</span>,
<a href="#1613" id="1613" class="l">1613: </a>                    <span class="php-var">$this</span>-&gt;LE);
<a href="#1614" id="1614" class="l">1614: </a>
<a href="#1615" id="1615" class="l">1615: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$disposition</span> == <span class="php-quote">'inline'</span>) {
<a href="#1616" id="1616" class="l">1616: </a>                <span class="php-var">$mime</span>[] = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;Content-ID: &lt;%s&gt;%s&quot;</span>, <span class="php-var">$cid</span>, <span class="php-var">$this</span>-&gt;LE);
<a href="#1617" id="1617" class="l">1617: </a>            }
<a href="#1618" id="1618" class="l">1618: </a>
<a href="#1619" id="1619" class="l">1619: </a>            <span class="php-var">$mime</span>[] = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;Content-Disposition: %s; filename=\&quot;%s\&quot;%s&quot;</span>,
<a href="#1620" id="1620" class="l">1620: </a>                    <span class="php-var">$disposition</span>,
<a href="#1621" id="1621" class="l">1621: </a>                    <span class="php-var">$this</span>-&gt;EncodeHeader(<span class="php-var">$this</span>-&gt;SecureHeader(<span class="php-var">$name</span>)),
<a href="#1622" id="1622" class="l">1622: </a>                    <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE);
<a href="#1623" id="1623" class="l">1623: </a>
<a href="#1624" id="1624" class="l">1624: </a>            <span class="php-comment">// Encode as string attachment</span>
<a href="#1625" id="1625" class="l">1625: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$bString</span>) {
<a href="#1626" id="1626" class="l">1626: </a>                <span class="php-var">$mime</span>[] = <span class="php-var">$this</span>-&gt;EncodeString(<span class="php-var">$string</span>, <span class="php-var">$encoding</span>);
<a href="#1627" id="1627" class="l">1627: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;IsError()) {
<a href="#1628" id="1628" class="l">1628: </a>                    <span class="php-keyword1">return</span> <span class="php-quote">''</span>;
<a href="#1629" id="1629" class="l">1629: </a>                }
<a href="#1630" id="1630" class="l">1630: </a>                <span class="php-var">$mime</span>[] = <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE;
<a href="#1631" id="1631" class="l">1631: </a>            } <span class="php-keyword1">else</span> {
<a href="#1632" id="1632" class="l">1632: </a>                <span class="php-var">$mime</span>[] = <span class="php-var">$this</span>-&gt;EncodeFile(<span class="php-var">$path</span>, <span class="php-var">$encoding</span>);
<a href="#1633" id="1633" class="l">1633: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;IsError()) {
<a href="#1634" id="1634" class="l">1634: </a>                    <span class="php-keyword1">return</span> <span class="php-quote">''</span>;
<a href="#1635" id="1635" class="l">1635: </a>                }
<a href="#1636" id="1636" class="l">1636: </a>                <span class="php-var">$mime</span>[] = <span class="php-var">$this</span>-&gt;LE . <span class="php-var">$this</span>-&gt;LE;
<a href="#1637" id="1637" class="l">1637: </a>            }
<a href="#1638" id="1638" class="l">1638: </a>        }
<a href="#1639" id="1639" class="l">1639: </a>
<a href="#1640" id="1640" class="l">1640: </a>        <span class="php-var">$mime</span>[] = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;--%s--%s&quot;</span>, <span class="php-var">$this</span>-&gt;boundary[<span class="php-num">1</span>], <span class="php-var">$this</span>-&gt;LE);
<a href="#1641" id="1641" class="l">1641: </a>
<a href="#1642" id="1642" class="l">1642: </a>        <span class="php-keyword1">return</span> <span class="php-keyword2">join</span>(<span class="php-quote">''</span>, <span class="php-var">$mime</span>);
<a href="#1643" id="1643" class="l">1643: </a>    }
<a href="#1644" id="1644" class="l">1644: </a>
<a href="#1645" id="1645" class="l">1645: </a>    <span class="php-comment">/**
</span><a href="#1646" id="1646" class="l">1646: </a><span class="php-comment">     * Encodes attachment in requested format.
</span><a href="#1647" id="1647" class="l">1647: </a><span class="php-comment">     * Returns an empty string on failure.
</span><a href="#1648" id="1648" class="l">1648: </a><span class="php-comment">     * @param string $path The full path to the file
</span><a href="#1649" id="1649" class="l">1649: </a><span class="php-comment">     * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
</span><a href="#1650" id="1650" class="l">1650: </a><span class="php-comment">     * @see EncodeFile()
</span><a href="#1651" id="1651" class="l">1651: </a><span class="php-comment">     * @access private
</span><a href="#1652" id="1652" class="l">1652: </a><span class="php-comment">     * @return string
</span><a href="#1653" id="1653" class="l">1653: </a><span class="php-comment">     */</span>
<a href="#1654" id="1654" class="l">1654: </a>
<a href="#1655" id="1655" class="l">1655: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> EncodeFile(<span class="php-var">$path</span>, <span class="php-var">$encoding</span> = <span class="php-quote">'base64'</span>)
<a href="#1656" id="1656" class="l">1656: </a>    {
<a href="#1657" id="1657" class="l">1657: </a>        <span class="php-keyword1">try</span> {
<a href="#1658" id="1658" class="l">1658: </a>            <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_readable</span>(<span class="php-var">$path</span>)) {
<a href="#1659" id="1659" class="l">1659: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'file_open'</span>) . <span class="php-var">$path</span>,
<a href="#1660" id="1660" class="l">1660: </a>                        self::STOP_CONTINUE);
<a href="#1661" id="1661" class="l">1661: </a>            }
<a href="#1662" id="1662" class="l">1662: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword2">function_exists</span>(<span class="php-quote">'get_magic_quotes'</span>)) {
<a href="#1663" id="1663" class="l">1663: </a>
<a href="#1664" id="1664" class="l">1664: </a>                <span class="php-keyword1">function</span> get_magic_quotes()
<a href="#1665" id="1665" class="l">1665: </a>                {
<a href="#1666" id="1666" class="l">1666: </a>                    <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#1667" id="1667" class="l">1667: </a>                }
<a href="#1668" id="1668" class="l">1668: </a>            }
<a href="#1669" id="1669" class="l">1669: </a>            <span class="php-keyword1">if</span> (PHP_VERSION &lt; <span class="php-num">6</span>) {
<a href="#1670" id="1670" class="l">1670: </a>                <span class="php-var">$magic_quotes</span> = <span class="php-keyword2">get_magic_quotes_runtime</span>();
<a href="#1671" id="1671" class="l">1671: </a>                <span class="php-keyword2">set_magic_quotes_runtime</span>(<span class="php-num">0</span>);
<a href="#1672" id="1672" class="l">1672: </a>            }
<a href="#1673" id="1673" class="l">1673: </a>            <span class="php-var">$file_buffer</span> = <span class="php-keyword2">file_get_contents</span>(<span class="php-var">$path</span>);
<a href="#1674" id="1674" class="l">1674: </a>            <span class="php-var">$file_buffer</span> = <span class="php-var">$this</span>-&gt;EncodeString(<span class="php-var">$file_buffer</span>, <span class="php-var">$encoding</span>);
<a href="#1675" id="1675" class="l">1675: </a>            <span class="php-keyword1">if</span> (PHP_VERSION &lt; <span class="php-num">6</span>) {
<a href="#1676" id="1676" class="l">1676: </a>                <span class="php-keyword2">set_magic_quotes_runtime</span>(<span class="php-var">$magic_quotes</span>);
<a href="#1677" id="1677" class="l">1677: </a>            }
<a href="#1678" id="1678" class="l">1678: </a>            <span class="php-keyword1">return</span> <span class="php-var">$file_buffer</span>;
<a href="#1679" id="1679" class="l">1679: </a>        } <span class="php-keyword1">catch</span> (Exception <span class="php-var">$e</span>) {
<a href="#1680" id="1680" class="l">1680: </a>            <span class="php-var">$this</span>-&gt;SetError(<span class="php-var">$e</span>-&gt;getMessage());
<a href="#1681" id="1681" class="l">1681: </a>            <span class="php-keyword1">return</span> <span class="php-quote">''</span>;
<a href="#1682" id="1682" class="l">1682: </a>        }
<a href="#1683" id="1683" class="l">1683: </a>    }
<a href="#1684" id="1684" class="l">1684: </a>
<a href="#1685" id="1685" class="l">1685: </a>    <span class="php-comment">/**
</span><a href="#1686" id="1686" class="l">1686: </a><span class="php-comment">     * Encodes string to requested format.
</span><a href="#1687" id="1687" class="l">1687: </a><span class="php-comment">     * Returns an empty string on failure.
</span><a href="#1688" id="1688" class="l">1688: </a><span class="php-comment">     * @param string $str The text to encode
</span><a href="#1689" id="1689" class="l">1689: </a><span class="php-comment">     * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
</span><a href="#1690" id="1690" class="l">1690: </a><span class="php-comment">     * @access public
</span><a href="#1691" id="1691" class="l">1691: </a><span class="php-comment">     * @return string
</span><a href="#1692" id="1692" class="l">1692: </a><span class="php-comment">     */</span>
<a href="#1693" id="1693" class="l">1693: </a>
<a href="#1694" id="1694" class="l">1694: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> EncodeString(<span class="php-var">$str</span>, <span class="php-var">$encoding</span> = <span class="php-quote">'base64'</span>)
<a href="#1695" id="1695" class="l">1695: </a>    {
<a href="#1696" id="1696" class="l">1696: </a>        <span class="php-var">$encoded</span> = <span class="php-quote">''</span>;
<a href="#1697" id="1697" class="l">1697: </a>        <span class="php-keyword1">switch</span> (<span class="php-keyword2">strtolower</span>(<span class="php-var">$encoding</span>)) {
<a href="#1698" id="1698" class="l">1698: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'base64'</span>:
<a href="#1699" id="1699" class="l">1699: </a>                <span class="php-var">$encoded</span> = <span class="php-keyword2">chunk_split</span>(<span class="php-keyword2">base64_encode</span>(<span class="php-var">$str</span>), <span class="php-num">76</span>, <span class="php-var">$this</span>-&gt;LE);
<a href="#1700" id="1700" class="l">1700: </a>                <span class="php-keyword1">break</span>;
<a href="#1701" id="1701" class="l">1701: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'7bit'</span>:
<a href="#1702" id="1702" class="l">1702: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'8bit'</span>:
<a href="#1703" id="1703" class="l">1703: </a>                <span class="php-var">$encoded</span> = <span class="php-var">$this</span>-&gt;FixEOL(<span class="php-var">$str</span>);
<a href="#1704" id="1704" class="l">1704: </a>                <span class="php-comment">//Make sure it ends with a line break</span>
<a href="#1705" id="1705" class="l">1705: </a>                <span class="php-keyword1">if</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$encoded</span>, -(<span class="php-keyword2">strlen</span>(<span class="php-var">$this</span>-&gt;LE))) != <span class="php-var">$this</span>-&gt;LE)
<a href="#1706" id="1706" class="l">1706: </a>                    <span class="php-var">$encoded</span> .= <span class="php-var">$this</span>-&gt;LE;
<a href="#1707" id="1707" class="l">1707: </a>                <span class="php-keyword1">break</span>;
<a href="#1708" id="1708" class="l">1708: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'binary'</span>:
<a href="#1709" id="1709" class="l">1709: </a>                <span class="php-var">$encoded</span> = <span class="php-var">$str</span>;
<a href="#1710" id="1710" class="l">1710: </a>                <span class="php-keyword1">break</span>;
<a href="#1711" id="1711" class="l">1711: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'quoted-printable'</span>:
<a href="#1712" id="1712" class="l">1712: </a>                <span class="php-var">$encoded</span> = <span class="php-var">$this</span>-&gt;EncodeQP(<span class="php-var">$str</span>);
<a href="#1713" id="1713" class="l">1713: </a>                <span class="php-keyword1">break</span>;
<a href="#1714" id="1714" class="l">1714: </a>            <span class="php-keyword1">default</span>:
<a href="#1715" id="1715" class="l">1715: </a>                <span class="php-var">$this</span>-&gt;SetError(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'encoding'</span>) . <span class="php-var">$encoding</span>);
<a href="#1716" id="1716" class="l">1716: </a>                <span class="php-keyword1">break</span>;
<a href="#1717" id="1717" class="l">1717: </a>        }
<a href="#1718" id="1718" class="l">1718: </a>        <span class="php-keyword1">return</span> <span class="php-var">$encoded</span>;
<a href="#1719" id="1719" class="l">1719: </a>    }
<a href="#1720" id="1720" class="l">1720: </a>
<a href="#1721" id="1721" class="l">1721: </a>    <span class="php-comment">/**
</span><a href="#1722" id="1722" class="l">1722: </a><span class="php-comment">     * Encode a header string to best (shortest) of Q, B, quoted or none.
</span><a href="#1723" id="1723" class="l">1723: </a><span class="php-comment">     * @access public
</span><a href="#1724" id="1724" class="l">1724: </a><span class="php-comment">     * @return string
</span><a href="#1725" id="1725" class="l">1725: </a><span class="php-comment">     */</span>
<a href="#1726" id="1726" class="l">1726: </a>
<a href="#1727" id="1727" class="l">1727: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> EncodeHeader(<span class="php-var">$str</span>, <span class="php-var">$position</span> = <span class="php-quote">'text'</span>)
<a href="#1728" id="1728" class="l">1728: </a>    {
<a href="#1729" id="1729" class="l">1729: </a>        <span class="php-var">$x</span> = <span class="php-num">0</span>;
<a href="#1730" id="1730" class="l">1730: </a>
<a href="#1731" id="1731" class="l">1731: </a>        <span class="php-keyword1">switch</span> (<span class="php-keyword2">strtolower</span>(<span class="php-var">$position</span>)) {
<a href="#1732" id="1732" class="l">1732: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'phrase'</span>:
<a href="#1733" id="1733" class="l">1733: </a>                <span class="php-keyword1">if</span> (!<span class="php-keyword2">preg_match</span>(<span class="php-quote">'/[\200-\377]/'</span>, <span class="php-var">$str</span>)) {
<a href="#1734" id="1734" class="l">1734: </a>                    <span class="php-comment">// Can't use addslashes as we don't know what value has magic_quotes_sybase</span>
<a href="#1735" id="1735" class="l">1735: </a>                    <span class="php-var">$encoded</span> = <span class="php-keyword2">addcslashes</span>(<span class="php-var">$str</span>, <span class="php-quote">&quot;\0..\37\177\\\&quot;&quot;</span>);
<a href="#1736" id="1736" class="l">1736: </a>                    <span class="php-keyword1">if</span> ((<span class="php-var">$str</span> == <span class="php-var">$encoded</span>)
<a href="#1737" id="1737" class="l">1737: </a>                            &amp;&amp; !<span class="php-keyword2">preg_match</span>(
<a href="#1738" id="1738" class="l">1738: </a>                                    <span class="php-quote">'/[^A-Za-z0-9!#$%&amp;\'*+\/=?^_`{|}~ -]/'</span>,
<a href="#1739" id="1739" class="l">1739: </a>                                    <span class="php-var">$str</span>)) {
<a href="#1740" id="1740" class="l">1740: </a>                        <span class="php-keyword1">return</span> (<span class="php-var">$encoded</span>);
<a href="#1741" id="1741" class="l">1741: </a>                    } <span class="php-keyword1">else</span> {
<a href="#1742" id="1742" class="l">1742: </a>                        <span class="php-keyword1">return</span> (<span class="php-quote">&quot;\&quot;</span><span class="php-var">$encoded</span><span class="php-quote">\&quot;&quot;</span>);
<a href="#1743" id="1743" class="l">1743: </a>                    }
<a href="#1744" id="1744" class="l">1744: </a>                }
<a href="#1745" id="1745" class="l">1745: </a>                <span class="php-var">$x</span> = <span class="php-keyword2">preg_match_all</span>(<span class="php-quote">'/[^\040\041\043-\133\135-\176]/'</span>, <span class="php-var">$str</span>,
<a href="#1746" id="1746" class="l">1746: </a>                        <span class="php-var">$matches</span>);
<a href="#1747" id="1747" class="l">1747: </a>                <span class="php-keyword1">break</span>;
<a href="#1748" id="1748" class="l">1748: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'comment'</span>:
<a href="#1749" id="1749" class="l">1749: </a>                <span class="php-var">$x</span> = <span class="php-keyword2">preg_match_all</span>(<span class="php-quote">'/[()&quot;]/'</span>, <span class="php-var">$str</span>, <span class="php-var">$matches</span>);
<a href="#1750" id="1750" class="l">1750: </a>            <span class="php-comment">// Fall-through</span>
<a href="#1751" id="1751" class="l">1751: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'text'</span>:
<a href="#1752" id="1752" class="l">1752: </a>            <span class="php-keyword1">default</span>:
<a href="#1753" id="1753" class="l">1753: </a>                <span class="php-var">$x</span> += <span class="php-keyword2">preg_match_all</span>(
<a href="#1754" id="1754" class="l">1754: </a>                        <span class="php-quote">'/[\000-\010\013\014\016-\037\177-\377]/'</span>, <span class="php-var">$str</span>,
<a href="#1755" id="1755" class="l">1755: </a>                        <span class="php-var">$matches</span>);
<a href="#1756" id="1756" class="l">1756: </a>                <span class="php-keyword1">break</span>;
<a href="#1757" id="1757" class="l">1757: </a>        }
<a href="#1758" id="1758" class="l">1758: </a>
<a href="#1759" id="1759" class="l">1759: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$x</span> == <span class="php-num">0</span>) {
<a href="#1760" id="1760" class="l">1760: </a>            <span class="php-keyword1">return</span> (<span class="php-var">$str</span>);
<a href="#1761" id="1761" class="l">1761: </a>        }
<a href="#1762" id="1762" class="l">1762: </a>
<a href="#1763" id="1763" class="l">1763: </a>        <span class="php-var">$maxlen</span> = <span class="php-num">75</span> - <span class="php-num">7</span> - <span class="php-keyword2">strlen</span>(<span class="php-var">$this</span>-&gt;CharSet);
<a href="#1764" id="1764" class="l">1764: </a>        <span class="php-comment">// Try to select the encoding which should produce the shortest output</span>
<a href="#1765" id="1765" class="l">1765: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$str</span>) / <span class="php-num">3</span> &lt; <span class="php-var">$x</span>) {
<a href="#1766" id="1766" class="l">1766: </a>            <span class="php-var">$encoding</span> = <span class="php-quote">'B'</span>;
<a href="#1767" id="1767" class="l">1767: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword2">function_exists</span>(<span class="php-quote">'mb_strlen'</span>) &amp;&amp; <span class="php-var">$this</span>-&gt;HasMultiBytes(<span class="php-var">$str</span>)) {
<a href="#1768" id="1768" class="l">1768: </a>                <span class="php-comment">// Use a custom function which correctly encodes and wraps long</span>
<a href="#1769" id="1769" class="l">1769: </a>                <span class="php-comment">// multibyte strings without breaking lines within a character</span>
<a href="#1770" id="1770" class="l">1770: </a>                <span class="php-var">$encoded</span> = <span class="php-var">$this</span>-&gt;Base64EncodeWrapMB(<span class="php-var">$str</span>);
<a href="#1771" id="1771" class="l">1771: </a>            } <span class="php-keyword1">else</span> {
<a href="#1772" id="1772" class="l">1772: </a>                <span class="php-var">$encoded</span> = <span class="php-keyword2">base64_encode</span>(<span class="php-var">$str</span>);
<a href="#1773" id="1773" class="l">1773: </a>                <span class="php-var">$maxlen</span> -= <span class="php-var">$maxlen</span> % <span class="php-num">4</span>;
<a href="#1774" id="1774" class="l">1774: </a>                <span class="php-var">$encoded</span> = <span class="php-keyword2">trim</span>(<span class="php-keyword2">chunk_split</span>(<span class="php-var">$encoded</span>, <span class="php-var">$maxlen</span>, <span class="php-quote">&quot;\n&quot;</span>));
<a href="#1775" id="1775" class="l">1775: </a>            }
<a href="#1776" id="1776" class="l">1776: </a>        } <span class="php-keyword1">else</span> {
<a href="#1777" id="1777" class="l">1777: </a>            <span class="php-var">$encoding</span> = <span class="php-quote">'Q'</span>;
<a href="#1778" id="1778" class="l">1778: </a>            <span class="php-var">$encoded</span> = <span class="php-var">$this</span>-&gt;EncodeQ(<span class="php-var">$str</span>, <span class="php-var">$position</span>);
<a href="#1779" id="1779" class="l">1779: </a>            <span class="php-var">$encoded</span> = <span class="php-var">$this</span>-&gt;WrapText(<span class="php-var">$encoded</span>, <span class="php-var">$maxlen</span>, <span class="php-keyword1">TRUE</span>);
<a href="#1780" id="1780" class="l">1780: </a>            <span class="php-var">$encoded</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">'='</span> . <span class="php-var">$this</span>-&gt;LE, <span class="php-quote">&quot;\n&quot;</span>, <span class="php-keyword2">trim</span>(<span class="php-var">$encoded</span>));
<a href="#1781" id="1781" class="l">1781: </a>        }
<a href="#1782" id="1782" class="l">1782: </a>
<a href="#1783" id="1783" class="l">1783: </a>        <span class="php-var">$encoded</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">'/^(.*)$/m'</span>,
<a href="#1784" id="1784" class="l">1784: </a>                <span class="php-quote">&quot; =?&quot;</span> . <span class="php-var">$this</span>-&gt;CharSet . <span class="php-quote">&quot;?</span><span class="php-var">$encoding</span><span class="php-quote">?\\1?=&quot;</span>, <span class="php-var">$encoded</span>);
<a href="#1785" id="1785" class="l">1785: </a>        <span class="php-var">$encoded</span> = <span class="php-keyword2">trim</span>(<span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\n&quot;</span>, <span class="php-var">$this</span>-&gt;LE, <span class="php-var">$encoded</span>));
<a href="#1786" id="1786" class="l">1786: </a>
<a href="#1787" id="1787" class="l">1787: </a>        <span class="php-keyword1">return</span> <span class="php-var">$encoded</span>;
<a href="#1788" id="1788" class="l">1788: </a>    }
<a href="#1789" id="1789" class="l">1789: </a>
<a href="#1790" id="1790" class="l">1790: </a>    <span class="php-comment">/**
</span><a href="#1791" id="1791" class="l">1791: </a><span class="php-comment">     * Checks if a string contains multibyte characters.
</span><a href="#1792" id="1792" class="l">1792: </a><span class="php-comment">     * @access public
</span><a href="#1793" id="1793" class="l">1793: </a><span class="php-comment">     * @param string $str multi-byte text to wrap encode
</span><a href="#1794" id="1794" class="l">1794: </a><span class="php-comment">     * @return bool
</span><a href="#1795" id="1795" class="l">1795: </a><span class="php-comment">     */</span>
<a href="#1796" id="1796" class="l">1796: </a>
<a href="#1797" id="1797" class="l">1797: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> HasMultiBytes(<span class="php-var">$str</span>)
<a href="#1798" id="1798" class="l">1798: </a>    {
<a href="#1799" id="1799" class="l">1799: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">function_exists</span>(<span class="php-quote">'mb_strlen'</span>)) {
<a href="#1800" id="1800" class="l">1800: </a>            <span class="php-keyword1">return</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$str</span>) &gt; <span class="php-keyword2">mb_strlen</span>(<span class="php-var">$str</span>, <span class="php-var">$this</span>-&gt;CharSet));
<a href="#1801" id="1801" class="l">1801: </a>        } <span class="php-keyword1">else</span> { <span class="php-comment">// Assume no multibytes (we can't handle without mbstring functions anyway)</span>
<a href="#1802" id="1802" class="l">1802: </a>            <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#1803" id="1803" class="l">1803: </a>        }
<a href="#1804" id="1804" class="l">1804: </a>    }
<a href="#1805" id="1805" class="l">1805: </a>
<a href="#1806" id="1806" class="l">1806: </a>    <span class="php-comment">/**
</span><a href="#1807" id="1807" class="l">1807: </a><span class="php-comment">     * Correctly encodes and wraps long multibyte strings for mail headers
</span><a href="#1808" id="1808" class="l">1808: </a><span class="php-comment">     * without breaking lines within a character.
</span><a href="#1809" id="1809" class="l">1809: </a><span class="php-comment">     * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
</span><a href="#1810" id="1810" class="l">1810: </a><span class="php-comment">     * @access public
</span><a href="#1811" id="1811" class="l">1811: </a><span class="php-comment">     * @param string $str multi-byte text to wrap encode
</span><a href="#1812" id="1812" class="l">1812: </a><span class="php-comment">     * @return string
</span><a href="#1813" id="1813" class="l">1813: </a><span class="php-comment">     */</span>
<a href="#1814" id="1814" class="l">1814: </a>
<a href="#1815" id="1815" class="l">1815: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> Base64EncodeWrapMB(<span class="php-var">$str</span>)
<a href="#1816" id="1816" class="l">1816: </a>    {
<a href="#1817" id="1817" class="l">1817: </a>        <span class="php-var">$start</span> = <span class="php-quote">&quot;=?&quot;</span> . <span class="php-var">$this</span>-&gt;CharSet . <span class="php-quote">&quot;?B?&quot;</span>;
<a href="#1818" id="1818" class="l">1818: </a>        <span class="php-var">$end</span> = <span class="php-quote">&quot;?=&quot;</span>;
<a href="#1819" id="1819" class="l">1819: </a>        <span class="php-var">$encoded</span> = <span class="php-quote">&quot;&quot;</span>;
<a href="#1820" id="1820" class="l">1820: </a>
<a href="#1821" id="1821" class="l">1821: </a>        <span class="php-var">$mb_length</span> = <span class="php-keyword2">mb_strlen</span>(<span class="php-var">$str</span>, <span class="php-var">$this</span>-&gt;CharSet);
<a href="#1822" id="1822" class="l">1822: </a>        <span class="php-comment">// Each line must have length &lt;= 75, including $start and $end</span>
<a href="#1823" id="1823" class="l">1823: </a>        <span class="php-var">$length</span> = <span class="php-num">75</span> - <span class="php-keyword2">strlen</span>(<span class="php-var">$start</span>) - <span class="php-keyword2">strlen</span>(<span class="php-var">$end</span>);
<a href="#1824" id="1824" class="l">1824: </a>        <span class="php-comment">// Average multi-byte ratio</span>
<a href="#1825" id="1825" class="l">1825: </a>        <span class="php-var">$ratio</span> = <span class="php-var">$mb_length</span> / <span class="php-keyword2">strlen</span>(<span class="php-var">$str</span>);
<a href="#1826" id="1826" class="l">1826: </a>        <span class="php-comment">// Base64 has a 4:3 ratio</span>
<a href="#1827" id="1827" class="l">1827: </a>        <span class="php-var">$offset</span> = <span class="php-var">$avgLength</span> = <span class="php-keyword2">floor</span>(<span class="php-var">$length</span> * <span class="php-var">$ratio</span> * <span class="php-num">.75</span>);
<a href="#1828" id="1828" class="l">1828: </a>
<a href="#1829" id="1829" class="l">1829: </a>        <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> &lt; <span class="php-var">$mb_length</span>; <span class="php-var">$i</span> += <span class="php-var">$offset</span>) {
<a href="#1830" id="1830" class="l">1830: </a>            <span class="php-var">$lookBack</span> = <span class="php-num">0</span>;
<a href="#1831" id="1831" class="l">1831: </a>
<a href="#1832" id="1832" class="l">1832: </a>            <span class="php-keyword1">do</span> {
<a href="#1833" id="1833" class="l">1833: </a>                <span class="php-var">$offset</span> = <span class="php-var">$avgLength</span> - <span class="php-var">$lookBack</span>;
<a href="#1834" id="1834" class="l">1834: </a>                <span class="php-var">$chunk</span> = <span class="php-keyword2">mb_substr</span>(<span class="php-var">$str</span>, <span class="php-var">$i</span>, <span class="php-var">$offset</span>, <span class="php-var">$this</span>-&gt;CharSet);
<a href="#1835" id="1835" class="l">1835: </a>                <span class="php-var">$chunk</span> = <span class="php-keyword2">base64_encode</span>(<span class="php-var">$chunk</span>);
<a href="#1836" id="1836" class="l">1836: </a>                <span class="php-var">$lookBack</span>++;
<a href="#1837" id="1837" class="l">1837: </a>            } <span class="php-keyword1">while</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$chunk</span>) &gt; <span class="php-var">$length</span>);
<a href="#1838" id="1838" class="l">1838: </a>
<a href="#1839" id="1839" class="l">1839: </a>            <span class="php-var">$encoded</span> .= <span class="php-var">$chunk</span> . <span class="php-var">$this</span>-&gt;LE;
<a href="#1840" id="1840" class="l">1840: </a>        }
<a href="#1841" id="1841" class="l">1841: </a>
<a href="#1842" id="1842" class="l">1842: </a>        <span class="php-comment">// Chomp the last linefeed</span>
<a href="#1843" id="1843" class="l">1843: </a>        <span class="php-var">$encoded</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$encoded</span>, <span class="php-num">0</span>, -<span class="php-keyword2">strlen</span>(<span class="php-var">$this</span>-&gt;LE));
<a href="#1844" id="1844" class="l">1844: </a>        <span class="php-keyword1">return</span> <span class="php-var">$encoded</span>;
<a href="#1845" id="1845" class="l">1845: </a>    }
<a href="#1846" id="1846" class="l">1846: </a>
<a href="#1847" id="1847" class="l">1847: </a>    <span class="php-comment">/**
</span><a href="#1848" id="1848" class="l">1848: </a><span class="php-comment">     * Encode string to quoted-printable.
</span><a href="#1849" id="1849" class="l">1849: </a><span class="php-comment">     * Only uses standard PHP, slow, but will always work
</span><a href="#1850" id="1850" class="l">1850: </a><span class="php-comment">     * @access public
</span><a href="#1851" id="1851" class="l">1851: </a><span class="php-comment">     * @param string $string the text to encode
</span><a href="#1852" id="1852" class="l">1852: </a><span class="php-comment">     * @param integer $line_max Number of chars allowed on a line before wrapping
</span><a href="#1853" id="1853" class="l">1853: </a><span class="php-comment">     * @return string
</span><a href="#1854" id="1854" class="l">1854: </a><span class="php-comment">     */</span>
<a href="#1855" id="1855" class="l">1855: </a>
<a href="#1856" id="1856" class="l">1856: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> EncodeQPphp(<span class="php-var">$input</span> = <span class="php-quote">''</span>, <span class="php-var">$line_max</span> = <span class="php-num">76</span>,
<a href="#1857" id="1857" class="l">1857: </a>            <span class="php-var">$space_conv</span> = <span class="php-keyword1">FALSE</span>)
<a href="#1858" id="1858" class="l">1858: </a>    {
<a href="#1859" id="1859" class="l">1859: </a>        <span class="php-var">$hex</span> = <span class="php-keyword1">array</span>(
<a href="#1860" id="1860" class="l">1860: </a>                <span class="php-quote">'0'</span>,
<a href="#1861" id="1861" class="l">1861: </a>                <span class="php-quote">'1'</span>,
<a href="#1862" id="1862" class="l">1862: </a>                <span class="php-quote">'2'</span>,
<a href="#1863" id="1863" class="l">1863: </a>                <span class="php-quote">'3'</span>,
<a href="#1864" id="1864" class="l">1864: </a>                <span class="php-quote">'4'</span>,
<a href="#1865" id="1865" class="l">1865: </a>                <span class="php-quote">'5'</span>,
<a href="#1866" id="1866" class="l">1866: </a>                <span class="php-quote">'6'</span>,
<a href="#1867" id="1867" class="l">1867: </a>                <span class="php-quote">'7'</span>,
<a href="#1868" id="1868" class="l">1868: </a>                <span class="php-quote">'8'</span>,
<a href="#1869" id="1869" class="l">1869: </a>                <span class="php-quote">'9'</span>,
<a href="#1870" id="1870" class="l">1870: </a>                <span class="php-quote">'A'</span>,
<a href="#1871" id="1871" class="l">1871: </a>                <span class="php-quote">'B'</span>,
<a href="#1872" id="1872" class="l">1872: </a>                <span class="php-quote">'C'</span>,
<a href="#1873" id="1873" class="l">1873: </a>                <span class="php-quote">'D'</span>,
<a href="#1874" id="1874" class="l">1874: </a>                <span class="php-quote">'E'</span>,
<a href="#1875" id="1875" class="l">1875: </a>                <span class="php-quote">'F'</span>
<a href="#1876" id="1876" class="l">1876: </a>        );
<a href="#1877" id="1877" class="l">1877: </a>        <span class="php-var">$lines</span> = <span class="php-keyword2">preg_split</span>(<span class="php-quote">'/(?:\r\n|\r|\n)/'</span>, <span class="php-var">$input</span>);
<a href="#1878" id="1878" class="l">1878: </a>        <span class="php-var">$eol</span> = <span class="php-quote">&quot;\r\n&quot;</span>;
<a href="#1879" id="1879" class="l">1879: </a>        <span class="php-var">$escape</span> = <span class="php-quote">'='</span>;
<a href="#1880" id="1880" class="l">1880: </a>        <span class="php-var">$output</span> = <span class="php-quote">''</span>;
<a href="#1881" id="1881" class="l">1881: </a>        <span class="php-keyword1">while</span> (<span class="php-keyword1">list</span>(, <span class="php-var">$line</span>) = <span class="php-keyword2">each</span>(<span class="php-var">$lines</span>)) {
<a href="#1882" id="1882" class="l">1882: </a>            <span class="php-var">$linlen</span> = <span class="php-keyword2">strlen</span>(<span class="php-var">$line</span>);
<a href="#1883" id="1883" class="l">1883: </a>            <span class="php-var">$newline</span> = <span class="php-quote">''</span>;
<a href="#1884" id="1884" class="l">1884: </a>            <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> &lt; <span class="php-var">$linlen</span>; <span class="php-var">$i</span>++) {
<a href="#1885" id="1885" class="l">1885: </a>                <span class="php-var">$c</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$line</span>, <span class="php-var">$i</span>, <span class="php-num">1</span>);
<a href="#1886" id="1886" class="l">1886: </a>                <span class="php-var">$dec</span> = <span class="php-keyword2">ord</span>(<span class="php-var">$c</span>);
<a href="#1887" id="1887" class="l">1887: </a>                <span class="php-keyword1">if</span> ((<span class="php-var">$i</span> == <span class="php-num">0</span>) &amp;&amp; (<span class="php-var">$dec</span> == <span class="php-num">46</span>)) { <span class="php-comment">// convert first point in the line into =2E</span>
<a href="#1888" id="1888" class="l">1888: </a>                    <span class="php-var">$c</span> = <span class="php-quote">'=2E'</span>;
<a href="#1889" id="1889" class="l">1889: </a>                }
<a href="#1890" id="1890" class="l">1890: </a>                <span class="php-keyword1">if</span> (<span class="php-var">$dec</span> == <span class="php-num">32</span>) {
<a href="#1891" id="1891" class="l">1891: </a>                    <span class="php-keyword1">if</span> (<span class="php-var">$i</span> == (<span class="php-var">$linlen</span> - <span class="php-num">1</span>)) { <span class="php-comment">// convert space at eol only</span>
<a href="#1892" id="1892" class="l">1892: </a>                        <span class="php-var">$c</span> = <span class="php-quote">'=20'</span>;
<a href="#1893" id="1893" class="l">1893: </a>                    } <span class="php-keyword1">else</span> <span class="php-keyword1">if</span> (<span class="php-var">$space_conv</span>) {
<a href="#1894" id="1894" class="l">1894: </a>                        <span class="php-var">$c</span> = <span class="php-quote">'=20'</span>;
<a href="#1895" id="1895" class="l">1895: </a>                    }
<a href="#1896" id="1896" class="l">1896: </a>                } <span class="php-keyword1">elseif</span> ((<span class="php-var">$dec</span> == <span class="php-num">61</span>) || (<span class="php-var">$dec</span> &lt; <span class="php-num">32</span>) || (<span class="php-var">$dec</span> &gt; <span class="php-num">126</span>)) { <span class="php-comment">// always encode &quot;\t&quot;, which is *not* required</span>
<a href="#1897" id="1897" class="l">1897: </a>                    <span class="php-var">$h2</span> = <span class="php-keyword2">floor</span>(<span class="php-var">$dec</span> / <span class="php-num">16</span>);
<a href="#1898" id="1898" class="l">1898: </a>                    <span class="php-var">$h1</span> = <span class="php-keyword2">floor</span>(<span class="php-var">$dec</span> % <span class="php-num">16</span>);
<a href="#1899" id="1899" class="l">1899: </a>                    <span class="php-var">$c</span> = <span class="php-var">$escape</span> . <span class="php-var">$hex</span>[<span class="php-var">$h2</span>] . <span class="php-var">$hex</span>[<span class="php-var">$h1</span>];
<a href="#1900" id="1900" class="l">1900: </a>                }
<a href="#1901" id="1901" class="l">1901: </a>                <span class="php-keyword1">if</span> ((<span class="php-keyword2">strlen</span>(<span class="php-var">$newline</span>) + <span class="php-keyword2">strlen</span>(<span class="php-var">$c</span>)) &gt;= <span class="php-var">$line_max</span>) { <span class="php-comment">// CRLF is not counted</span>
<a href="#1902" id="1902" class="l">1902: </a>                    <span class="php-var">$output</span> .= <span class="php-var">$newline</span> . <span class="php-var">$escape</span> . <span class="php-var">$eol</span>; <span class="php-comment">//  soft line break; &quot; =\r\n&quot; is okay</span>
<a href="#1903" id="1903" class="l">1903: </a>                    <span class="php-var">$newline</span> = <span class="php-quote">''</span>;
<a href="#1904" id="1904" class="l">1904: </a>                    <span class="php-comment">// check if newline first character will be point or not</span>
<a href="#1905" id="1905" class="l">1905: </a>                    <span class="php-keyword1">if</span> (<span class="php-var">$dec</span> == <span class="php-num">46</span>) {
<a href="#1906" id="1906" class="l">1906: </a>                        <span class="php-var">$c</span> = <span class="php-quote">'=2E'</span>;
<a href="#1907" id="1907" class="l">1907: </a>                    }
<a href="#1908" id="1908" class="l">1908: </a>                }
<a href="#1909" id="1909" class="l">1909: </a>                <span class="php-var">$newline</span> .= <span class="php-var">$c</span>;
<a href="#1910" id="1910" class="l">1910: </a>            } <span class="php-comment">// end of for</span>
<a href="#1911" id="1911" class="l">1911: </a>            <span class="php-var">$output</span> .= <span class="php-var">$newline</span> . <span class="php-var">$eol</span>;
<a href="#1912" id="1912" class="l">1912: </a>        } <span class="php-comment">// end of while</span>
<a href="#1913" id="1913" class="l">1913: </a>        <span class="php-keyword1">return</span> <span class="php-var">$output</span>;
<a href="#1914" id="1914" class="l">1914: </a>    }
<a href="#1915" id="1915" class="l">1915: </a>
<a href="#1916" id="1916" class="l">1916: </a>    <span class="php-comment">/**
</span><a href="#1917" id="1917" class="l">1917: </a><span class="php-comment">     * Encode string to RFC2045 (6.7) quoted-printable format
</span><a href="#1918" id="1918" class="l">1918: </a><span class="php-comment">     * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version
</span><a href="#1919" id="1919" class="l">1919: </a><span class="php-comment">     * Also results in same content as you started with after decoding
</span><a href="#1920" id="1920" class="l">1920: </a><span class="php-comment">     * @see EncodeQPphp()
</span><a href="#1921" id="1921" class="l">1921: </a><span class="php-comment">     * @access public
</span><a href="#1922" id="1922" class="l">1922: </a><span class="php-comment">     * @param string $string the text to encode
</span><a href="#1923" id="1923" class="l">1923: </a><span class="php-comment">     * @param integer $line_max Number of chars allowed on a line before wrapping
</span><a href="#1924" id="1924" class="l">1924: </a><span class="php-comment">     * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function
</span><a href="#1925" id="1925" class="l">1925: </a><span class="php-comment">     * @return string
</span><a href="#1926" id="1926" class="l">1926: </a><span class="php-comment">     * @author Marcus Bointon
</span><a href="#1927" id="1927" class="l">1927: </a><span class="php-comment">     */</span>
<a href="#1928" id="1928" class="l">1928: </a>
<a href="#1929" id="1929" class="l">1929: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> EncodeQP(<span class="php-var">$string</span>, <span class="php-var">$line_max</span> = <span class="php-num">76</span>, <span class="php-var">$space_conv</span> = <span class="php-keyword1">FALSE</span>)
<a href="#1930" id="1930" class="l">1930: </a>    {
<a href="#1931" id="1931" class="l">1931: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">function_exists</span>(<span class="php-quote">'quoted_printable_encode'</span>)) { <span class="php-comment">//Use native function if it's available (&gt;= PHP5.3)</span>
<a href="#1932" id="1932" class="l">1932: </a>            <span class="php-keyword1">return</span> <span class="php-keyword2">quoted_printable_encode</span>(<span class="php-var">$string</span>);
<a href="#1933" id="1933" class="l">1933: </a>        }
<a href="#1934" id="1934" class="l">1934: </a>        <span class="php-var">$filters</span> = <span class="php-keyword2">stream_get_filters</span>();
<a href="#1935" id="1935" class="l">1935: </a>        <span class="php-keyword1">if</span> (!<span class="php-keyword2">in_array</span>(<span class="php-quote">'convert.*'</span>, <span class="php-var">$filters</span>)) { <span class="php-comment">//Got convert stream filter?</span>
<a href="#1936" id="1936" class="l">1936: </a>            <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;EncodeQPphp(<span class="php-var">$string</span>, <span class="php-var">$line_max</span>, <span class="php-var">$space_conv</span>); <span class="php-comment">//Fall back to old implementation</span>
<a href="#1937" id="1937" class="l">1937: </a>        }
<a href="#1938" id="1938" class="l">1938: </a>        <span class="php-var">$fp</span> = <span class="php-keyword2">fopen</span>(<span class="php-quote">'php://temp/'</span>, <span class="php-quote">'r+'</span>);
<a href="#1939" id="1939" class="l">1939: </a>        <span class="php-var">$string</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">'/\r\n?/'</span>, <span class="php-var">$this</span>-&gt;LE, <span class="php-var">$string</span>); <span class="php-comment">//Normalise line breaks</span>
<a href="#1940" id="1940" class="l">1940: </a>        <span class="php-var">$params</span> = <span class="php-keyword1">array</span>(
<a href="#1941" id="1941" class="l">1941: </a>                <span class="php-quote">'line-length'</span> =&gt; <span class="php-var">$line_max</span>,
<a href="#1942" id="1942" class="l">1942: </a>                <span class="php-quote">'line-break-chars'</span> =&gt; <span class="php-var">$this</span>-&gt;LE
<a href="#1943" id="1943" class="l">1943: </a>        );
<a href="#1944" id="1944" class="l">1944: </a>        <span class="php-var">$s</span> = <span class="php-keyword2">stream_filter_append</span>(<span class="php-var">$fp</span>, <span class="php-quote">'convert.quoted-printable-encode'</span>,
<a href="#1945" id="1945" class="l">1945: </a>                STREAM_FILTER_READ, <span class="php-var">$params</span>);
<a href="#1946" id="1946" class="l">1946: </a>        <span class="php-keyword2">fputs</span>(<span class="php-var">$fp</span>, <span class="php-var">$string</span>);
<a href="#1947" id="1947" class="l">1947: </a>        <span class="php-keyword2">rewind</span>(<span class="php-var">$fp</span>);
<a href="#1948" id="1948" class="l">1948: </a>        <span class="php-var">$out</span> = <span class="php-keyword2">stream_get_contents</span>(<span class="php-var">$fp</span>);
<a href="#1949" id="1949" class="l">1949: </a>        <span class="php-keyword2">stream_filter_remove</span>(<span class="php-var">$s</span>);
<a href="#1950" id="1950" class="l">1950: </a>        <span class="php-var">$out</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">'/^\./m'</span>, <span class="php-quote">'=2E'</span>, <span class="php-var">$out</span>); <span class="php-comment">//Encode . if it is first char on a line, workaround for bug in Exchange</span>
<a href="#1951" id="1951" class="l">1951: </a>        <span class="php-keyword2">fclose</span>(<span class="php-var">$fp</span>);
<a href="#1952" id="1952" class="l">1952: </a>        <span class="php-keyword1">return</span> <span class="php-var">$out</span>;
<a href="#1953" id="1953" class="l">1953: </a>    }
<a href="#1954" id="1954" class="l">1954: </a>
<a href="#1955" id="1955" class="l">1955: </a>    <span class="php-comment">/**
</span><a href="#1956" id="1956" class="l">1956: </a><span class="php-comment">     * Encode string to q encoding.
</span><a href="#1957" id="1957" class="l">1957: </a><span class="php-comment">     * @link http://tools.ietf.org/html/rfc2047
</span><a href="#1958" id="1958" class="l">1958: </a><span class="php-comment">     * @param string $str the text to encode
</span><a href="#1959" id="1959" class="l">1959: </a><span class="php-comment">     * @param string $position Where the text is going to be used, see the RFC for what that means
</span><a href="#1960" id="1960" class="l">1960: </a><span class="php-comment">     * @access public
</span><a href="#1961" id="1961" class="l">1961: </a><span class="php-comment">     * @return string
</span><a href="#1962" id="1962" class="l">1962: </a><span class="php-comment">     */</span>
<a href="#1963" id="1963" class="l">1963: </a>
<a href="#1964" id="1964" class="l">1964: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> EncodeQ(<span class="php-var">$str</span>, <span class="php-var">$position</span> = <span class="php-quote">'text'</span>)
<a href="#1965" id="1965" class="l">1965: </a>    {
<a href="#1966" id="1966" class="l">1966: </a>        <span class="php-comment">// There should not be any EOL in the string</span>
<a href="#1967" id="1967" class="l">1967: </a>        <span class="php-var">$encoded</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">'/[\r\n]*/'</span>, <span class="php-quote">''</span>, <span class="php-var">$str</span>);
<a href="#1968" id="1968" class="l">1968: </a>
<a href="#1969" id="1969" class="l">1969: </a>        <span class="php-keyword1">switch</span> (<span class="php-keyword2">strtolower</span>(<span class="php-var">$position</span>)) {
<a href="#1970" id="1970" class="l">1970: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'phrase'</span>:
<a href="#1971" id="1971" class="l">1971: </a>                <span class="php-var">$encoded</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">&quot;/([^A-Za-z0-9!*+\/ -])/e&quot;</span>,
<a href="#1972" id="1972" class="l">1972: </a>                        <span class="php-quote">&quot;'='.sprintf('%02X', ord('\\1'))&quot;</span>, <span class="php-var">$encoded</span>);
<a href="#1973" id="1973" class="l">1973: </a>                <span class="php-keyword1">break</span>;
<a href="#1974" id="1974" class="l">1974: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'comment'</span>:
<a href="#1975" id="1975" class="l">1975: </a>                <span class="php-var">$encoded</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">&quot;/([\(\)\&quot;])/e&quot;</span>,
<a href="#1976" id="1976" class="l">1976: </a>                        <span class="php-quote">&quot;'='.sprintf('%02X', ord('\\1'))&quot;</span>, <span class="php-var">$encoded</span>);
<a href="#1977" id="1977" class="l">1977: </a>            <span class="php-keyword1">case</span> <span class="php-quote">'text'</span>:
<a href="#1978" id="1978" class="l">1978: </a>            <span class="php-keyword1">default</span>:
<a href="#1979" id="1979" class="l">1979: </a>            <span class="php-comment">// Replace every high ascii, control =, ? and _ characters</span>
<a href="#1980" id="1980" class="l">1980: </a>            <span class="php-comment">//TODO using /e (equivalent to eval()) is probably not a good idea</span>
<a href="#1981" id="1981" class="l">1981: </a>                <span class="php-var">$encoded</span> = <span class="php-keyword2">preg_replace</span>(
<a href="#1982" id="1982" class="l">1982: </a>                        <span class="php-quote">'/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e'</span>,
<a href="#1983" id="1983" class="l">1983: </a>                        <span class="php-quote">&quot;'='.sprintf('%02X', ord('\\1'))&quot;</span>, <span class="php-var">$encoded</span>);
<a href="#1984" id="1984" class="l">1984: </a>                <span class="php-keyword1">break</span>;
<a href="#1985" id="1985" class="l">1985: </a>        }
<a href="#1986" id="1986" class="l">1986: </a>
<a href="#1987" id="1987" class="l">1987: </a>        <span class="php-comment">// Replace every spaces to _ (more readable than =20)</span>
<a href="#1988" id="1988" class="l">1988: </a>        <span class="php-var">$encoded</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">' '</span>, <span class="php-quote">'_'</span>, <span class="php-var">$encoded</span>);
<a href="#1989" id="1989" class="l">1989: </a>
<a href="#1990" id="1990" class="l">1990: </a>        <span class="php-keyword1">return</span> <span class="php-var">$encoded</span>;
<a href="#1991" id="1991" class="l">1991: </a>    }
<a href="#1992" id="1992" class="l">1992: </a>
<a href="#1993" id="1993" class="l">1993: </a>    <span class="php-comment">/**
</span><a href="#1994" id="1994" class="l">1994: </a><span class="php-comment">     * Adds a string or binary attachment (non-filesystem) to the list.
</span><a href="#1995" id="1995" class="l">1995: </a><span class="php-comment">     * This method can be used to attach ascii or binary data,
</span><a href="#1996" id="1996" class="l">1996: </a><span class="php-comment">     * such as a BLOB record from a database.
</span><a href="#1997" id="1997" class="l">1997: </a><span class="php-comment">     * @param string $string String attachment data.
</span><a href="#1998" id="1998" class="l">1998: </a><span class="php-comment">     * @param string $filename Name of the attachment.
</span><a href="#1999" id="1999" class="l">1999: </a><span class="php-comment">     * @param string $encoding File encoding (see $Encoding).
</span><a href="#2000" id="2000" class="l">2000: </a><span class="php-comment">     * @param string $type File extension (MIME) type.
</span><a href="#2001" id="2001" class="l">2001: </a><span class="php-comment">     * @return void
</span><a href="#2002" id="2002" class="l">2002: </a><span class="php-comment">     */</span>
<a href="#2003" id="2003" class="l">2003: </a>
<a href="#2004" id="2004" class="l">2004: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddStringAttachment(<span class="php-var">$string</span>, <span class="php-var">$filename</span>,
<a href="#2005" id="2005" class="l">2005: </a>            <span class="php-var">$encoding</span> = <span class="php-quote">'base64'</span>, <span class="php-var">$type</span> = <span class="php-quote">'application/octet-stream'</span>)
<a href="#2006" id="2006" class="l">2006: </a>    {
<a href="#2007" id="2007" class="l">2007: </a>        <span class="php-comment">// Append to $attachment array</span>
<a href="#2008" id="2008" class="l">2008: </a>        <span class="php-var">$this</span>-&gt;attachment[] = <span class="php-keyword1">array</span>(
<a href="#2009" id="2009" class="l">2009: </a>                <span class="php-num">0</span> =&gt; <span class="php-var">$string</span>,
<a href="#2010" id="2010" class="l">2010: </a>                <span class="php-num">1</span> =&gt; <span class="php-var">$filename</span>,
<a href="#2011" id="2011" class="l">2011: </a>                <span class="php-num">2</span> =&gt; <span class="php-keyword2">basename</span>(<span class="php-var">$filename</span>),
<a href="#2012" id="2012" class="l">2012: </a>                <span class="php-num">3</span> =&gt; <span class="php-var">$encoding</span>,
<a href="#2013" id="2013" class="l">2013: </a>                <span class="php-num">4</span> =&gt; <span class="php-var">$type</span>,
<a href="#2014" id="2014" class="l">2014: </a>                <span class="php-num">5</span> =&gt; <span class="php-keyword1">TRUE</span>,
<a href="#2015" id="2015" class="l">2015: </a>                <span class="php-comment">// isStringAttachment</span>
<a href="#2016" id="2016" class="l">2016: </a>                <span class="php-num">6</span> =&gt; <span class="php-quote">'attachment'</span>,
<a href="#2017" id="2017" class="l">2017: </a>                <span class="php-num">7</span> =&gt; <span class="php-num">0</span>
<a href="#2018" id="2018" class="l">2018: </a>        );
<a href="#2019" id="2019" class="l">2019: </a>    }
<a href="#2020" id="2020" class="l">2020: </a>
<a href="#2021" id="2021" class="l">2021: </a>    <span class="php-comment">/**
</span><a href="#2022" id="2022" class="l">2022: </a><span class="php-comment">     * Adds an embedded attachment.  This can include images, sounds, and
</span><a href="#2023" id="2023" class="l">2023: </a><span class="php-comment">     * just about any other document.  Make sure to set the $type to an
</span><a href="#2024" id="2024" class="l">2024: </a><span class="php-comment">     * image type.  For JPEG images use &quot;image/jpeg&quot; and for GIF images
</span><a href="#2025" id="2025" class="l">2025: </a><span class="php-comment">     * use &quot;image/gif&quot;.
</span><a href="#2026" id="2026" class="l">2026: </a><span class="php-comment">     * @param string $path Path to the attachment.
</span><a href="#2027" id="2027" class="l">2027: </a><span class="php-comment">     * @param string $cid Content ID of the attachment.  Use this to identify
</span><a href="#2028" id="2028" class="l">2028: </a><span class="php-comment">     *        the Id for accessing the image in an HTML form.
</span><a href="#2029" id="2029" class="l">2029: </a><span class="php-comment">     * @param string $name Overrides the attachment name.
</span><a href="#2030" id="2030" class="l">2030: </a><span class="php-comment">     * @param string $encoding File encoding (see $Encoding).
</span><a href="#2031" id="2031" class="l">2031: </a><span class="php-comment">     * @param string $type File extension (MIME) type.
</span><a href="#2032" id="2032" class="l">2032: </a><span class="php-comment">     * @return bool
</span><a href="#2033" id="2033" class="l">2033: </a><span class="php-comment">     */</span>
<a href="#2034" id="2034" class="l">2034: </a>
<a href="#2035" id="2035" class="l">2035: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddEmbeddedImage(<span class="php-var">$path</span>, <span class="php-var">$cid</span>, <span class="php-var">$name</span> = <span class="php-quote">''</span>,
<a href="#2036" id="2036" class="l">2036: </a>            <span class="php-var">$encoding</span> = <span class="php-quote">'base64'</span>, <span class="php-var">$type</span> = <span class="php-quote">'application/octet-stream'</span>)
<a href="#2037" id="2037" class="l">2037: </a>    {
<a href="#2038" id="2038" class="l">2038: </a>
<a href="#2039" id="2039" class="l">2039: </a>        <span class="php-keyword1">if</span> (!@<span class="php-keyword2">is_file</span>(<span class="php-var">$path</span>)) {
<a href="#2040" id="2040" class="l">2040: </a>            <span class="php-var">$this</span>-&gt;SetError(<span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'file_access'</span>) . <span class="php-var">$path</span>);
<a href="#2041" id="2041" class="l">2041: </a>            <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#2042" id="2042" class="l">2042: </a>        }
<a href="#2043" id="2043" class="l">2043: </a>
<a href="#2044" id="2044" class="l">2044: </a>        <span class="php-var">$filename</span> = <span class="php-keyword2">basename</span>(<span class="php-var">$path</span>);
<a href="#2045" id="2045" class="l">2045: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$name</span> == <span class="php-quote">''</span>) {
<a href="#2046" id="2046" class="l">2046: </a>            <span class="php-var">$name</span> = <span class="php-var">$filename</span>;
<a href="#2047" id="2047" class="l">2047: </a>        }
<a href="#2048" id="2048" class="l">2048: </a>
<a href="#2049" id="2049" class="l">2049: </a>        <span class="php-comment">// Append to $attachment array</span>
<a href="#2050" id="2050" class="l">2050: </a>        <span class="php-var">$this</span>-&gt;attachment[] = <span class="php-keyword1">array</span>(
<a href="#2051" id="2051" class="l">2051: </a>                <span class="php-num">0</span> =&gt; <span class="php-var">$path</span>,
<a href="#2052" id="2052" class="l">2052: </a>                <span class="php-num">1</span> =&gt; <span class="php-var">$filename</span>,
<a href="#2053" id="2053" class="l">2053: </a>                <span class="php-num">2</span> =&gt; <span class="php-var">$name</span>,
<a href="#2054" id="2054" class="l">2054: </a>                <span class="php-num">3</span> =&gt; <span class="php-var">$encoding</span>,
<a href="#2055" id="2055" class="l">2055: </a>                <span class="php-num">4</span> =&gt; <span class="php-var">$type</span>,
<a href="#2056" id="2056" class="l">2056: </a>                <span class="php-num">5</span> =&gt; <span class="php-keyword1">FALSE</span>,
<a href="#2057" id="2057" class="l">2057: </a>                <span class="php-comment">// isStringAttachment</span>
<a href="#2058" id="2058" class="l">2058: </a>                <span class="php-num">6</span> =&gt; <span class="php-quote">'inline'</span>,
<a href="#2059" id="2059" class="l">2059: </a>                <span class="php-num">7</span> =&gt; <span class="php-var">$cid</span>
<a href="#2060" id="2060" class="l">2060: </a>        );
<a href="#2061" id="2061" class="l">2061: </a>
<a href="#2062" id="2062" class="l">2062: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#2063" id="2063" class="l">2063: </a>    }
<a href="#2064" id="2064" class="l">2064: </a>
<a href="#2065" id="2065" class="l">2065: </a>    <span class="php-comment">/**
</span><a href="#2066" id="2066" class="l">2066: </a><span class="php-comment">     * Returns TRUE if an inline attachment is present.
</span><a href="#2067" id="2067" class="l">2067: </a><span class="php-comment">     * @access public
</span><a href="#2068" id="2068" class="l">2068: </a><span class="php-comment">     * @return bool
</span><a href="#2069" id="2069" class="l">2069: </a><span class="php-comment">     */</span>
<a href="#2070" id="2070" class="l">2070: </a>
<a href="#2071" id="2071" class="l">2071: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> InlineImageExists()
<a href="#2072" id="2072" class="l">2072: </a>    {
<a href="#2073" id="2073" class="l">2073: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;attachment <span class="php-keyword1">as</span> <span class="php-var">$attachment</span>) {
<a href="#2074" id="2074" class="l">2074: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$attachment</span>[<span class="php-num">6</span>] == <span class="php-quote">'inline'</span>) {
<a href="#2075" id="2075" class="l">2075: </a>                <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#2076" id="2076" class="l">2076: </a>            }
<a href="#2077" id="2077" class="l">2077: </a>        }
<a href="#2078" id="2078" class="l">2078: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#2079" id="2079" class="l">2079: </a>    }
<a href="#2080" id="2080" class="l">2080: </a>
<a href="#2081" id="2081" class="l">2081: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#2082" id="2082" class="l">2082: </a>    <span class="php-comment">// CLASS METHODS, MESSAGE RESET</span>
<a href="#2083" id="2083" class="l">2083: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#2084" id="2084" class="l">2084: </a>
<a href="#2085" id="2085" class="l">2085: </a>    <span class="php-comment">/**
</span><a href="#2086" id="2086" class="l">2086: </a><span class="php-comment">     * Clears all recipients assigned in the TO array.  Returns void.
</span><a href="#2087" id="2087" class="l">2087: </a><span class="php-comment">     * @return void
</span><a href="#2088" id="2088" class="l">2088: </a><span class="php-comment">     */</span>
<a href="#2089" id="2089" class="l">2089: </a>
<a href="#2090" id="2090" class="l">2090: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> ClearAddresses()
<a href="#2091" id="2091" class="l">2091: </a>    {
<a href="#2092" id="2092" class="l">2092: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;to <span class="php-keyword1">as</span> <span class="php-var">$to</span>) {
<a href="#2093" id="2093" class="l">2093: </a>            <span class="php-keyword1">unset</span>(<span class="php-var">$this</span>-&gt;all_recipients[<span class="php-keyword2">strtolower</span>(<span class="php-var">$to</span>[<span class="php-num">0</span>])]);
<a href="#2094" id="2094" class="l">2094: </a>        }
<a href="#2095" id="2095" class="l">2095: </a>        <span class="php-var">$this</span>-&gt;to = <span class="php-keyword1">array</span>();
<a href="#2096" id="2096" class="l">2096: </a>    }
<a href="#2097" id="2097" class="l">2097: </a>
<a href="#2098" id="2098" class="l">2098: </a>    <span class="php-comment">/**
</span><a href="#2099" id="2099" class="l">2099: </a><span class="php-comment">     * Clears all recipients assigned in the CC array.  Returns void.
</span><a href="#2100" id="2100" class="l">2100: </a><span class="php-comment">     * @return void
</span><a href="#2101" id="2101" class="l">2101: </a><span class="php-comment">     */</span>
<a href="#2102" id="2102" class="l">2102: </a>
<a href="#2103" id="2103" class="l">2103: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> ClearCCs()
<a href="#2104" id="2104" class="l">2104: </a>    {
<a href="#2105" id="2105" class="l">2105: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;cc <span class="php-keyword1">as</span> <span class="php-var">$cc</span>) {
<a href="#2106" id="2106" class="l">2106: </a>            <span class="php-keyword1">unset</span>(<span class="php-var">$this</span>-&gt;all_recipients[<span class="php-keyword2">strtolower</span>(<span class="php-var">$cc</span>[<span class="php-num">0</span>])]);
<a href="#2107" id="2107" class="l">2107: </a>        }
<a href="#2108" id="2108" class="l">2108: </a>        <span class="php-var">$this</span>-&gt;cc = <span class="php-keyword1">array</span>();
<a href="#2109" id="2109" class="l">2109: </a>    }
<a href="#2110" id="2110" class="l">2110: </a>
<a href="#2111" id="2111" class="l">2111: </a>    <span class="php-comment">/**
</span><a href="#2112" id="2112" class="l">2112: </a><span class="php-comment">     * Clears all recipients assigned in the BCC array.  Returns void.
</span><a href="#2113" id="2113" class="l">2113: </a><span class="php-comment">     * @return void
</span><a href="#2114" id="2114" class="l">2114: </a><span class="php-comment">     */</span>
<a href="#2115" id="2115" class="l">2115: </a>
<a href="#2116" id="2116" class="l">2116: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> ClearBCCs()
<a href="#2117" id="2117" class="l">2117: </a>    {
<a href="#2118" id="2118" class="l">2118: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$this</span>-&gt;bcc <span class="php-keyword1">as</span> <span class="php-var">$bcc</span>) {
<a href="#2119" id="2119" class="l">2119: </a>            <span class="php-keyword1">unset</span>(<span class="php-var">$this</span>-&gt;all_recipients[<span class="php-keyword2">strtolower</span>(<span class="php-var">$bcc</span>[<span class="php-num">0</span>])]);
<a href="#2120" id="2120" class="l">2120: </a>        }
<a href="#2121" id="2121" class="l">2121: </a>        <span class="php-var">$this</span>-&gt;bcc = <span class="php-keyword1">array</span>();
<a href="#2122" id="2122" class="l">2122: </a>    }
<a href="#2123" id="2123" class="l">2123: </a>
<a href="#2124" id="2124" class="l">2124: </a>    <span class="php-comment">/**
</span><a href="#2125" id="2125" class="l">2125: </a><span class="php-comment">     * Clears all recipients assigned in the ReplyTo array.  Returns void.
</span><a href="#2126" id="2126" class="l">2126: </a><span class="php-comment">     * @return void
</span><a href="#2127" id="2127" class="l">2127: </a><span class="php-comment">     */</span>
<a href="#2128" id="2128" class="l">2128: </a>
<a href="#2129" id="2129" class="l">2129: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> ClearReplyTos()
<a href="#2130" id="2130" class="l">2130: </a>    {
<a href="#2131" id="2131" class="l">2131: </a>        <span class="php-var">$this</span>-&gt;ReplyTo = <span class="php-keyword1">array</span>();
<a href="#2132" id="2132" class="l">2132: </a>    }
<a href="#2133" id="2133" class="l">2133: </a>
<a href="#2134" id="2134" class="l">2134: </a>    <span class="php-comment">/**
</span><a href="#2135" id="2135" class="l">2135: </a><span class="php-comment">     * Clears all recipients assigned in the TO, CC and BCC
</span><a href="#2136" id="2136" class="l">2136: </a><span class="php-comment">     * array.  Returns void.
</span><a href="#2137" id="2137" class="l">2137: </a><span class="php-comment">     * @return void
</span><a href="#2138" id="2138" class="l">2138: </a><span class="php-comment">     */</span>
<a href="#2139" id="2139" class="l">2139: </a>
<a href="#2140" id="2140" class="l">2140: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> ClearAllRecipients()
<a href="#2141" id="2141" class="l">2141: </a>    {
<a href="#2142" id="2142" class="l">2142: </a>        <span class="php-var">$this</span>-&gt;to = <span class="php-keyword1">array</span>();
<a href="#2143" id="2143" class="l">2143: </a>        <span class="php-var">$this</span>-&gt;cc = <span class="php-keyword1">array</span>();
<a href="#2144" id="2144" class="l">2144: </a>        <span class="php-var">$this</span>-&gt;bcc = <span class="php-keyword1">array</span>();
<a href="#2145" id="2145" class="l">2145: </a>        <span class="php-var">$this</span>-&gt;all_recipients = <span class="php-keyword1">array</span>();
<a href="#2146" id="2146" class="l">2146: </a>    }
<a href="#2147" id="2147" class="l">2147: </a>
<a href="#2148" id="2148" class="l">2148: </a>    <span class="php-comment">/**
</span><a href="#2149" id="2149" class="l">2149: </a><span class="php-comment">     * Clears all previously set filesystem, string, and binary
</span><a href="#2150" id="2150" class="l">2150: </a><span class="php-comment">     * attachments.  Returns void.
</span><a href="#2151" id="2151" class="l">2151: </a><span class="php-comment">     * @return void
</span><a href="#2152" id="2152" class="l">2152: </a><span class="php-comment">     */</span>
<a href="#2153" id="2153" class="l">2153: </a>
<a href="#2154" id="2154" class="l">2154: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> ClearAttachments()
<a href="#2155" id="2155" class="l">2155: </a>    {
<a href="#2156" id="2156" class="l">2156: </a>        <span class="php-var">$this</span>-&gt;attachment = <span class="php-keyword1">array</span>();
<a href="#2157" id="2157" class="l">2157: </a>    }
<a href="#2158" id="2158" class="l">2158: </a>
<a href="#2159" id="2159" class="l">2159: </a>    <span class="php-comment">/**
</span><a href="#2160" id="2160" class="l">2160: </a><span class="php-comment">     * Clears all custom headers.  Returns void.
</span><a href="#2161" id="2161" class="l">2161: </a><span class="php-comment">     * @return void
</span><a href="#2162" id="2162" class="l">2162: </a><span class="php-comment">     */</span>
<a href="#2163" id="2163" class="l">2163: </a>
<a href="#2164" id="2164" class="l">2164: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> ClearCustomHeaders()
<a href="#2165" id="2165" class="l">2165: </a>    {
<a href="#2166" id="2166" class="l">2166: </a>        <span class="php-var">$this</span>-&gt;CustomHeader = <span class="php-keyword1">array</span>();
<a href="#2167" id="2167" class="l">2167: </a>    }
<a href="#2168" id="2168" class="l">2168: </a>
<a href="#2169" id="2169" class="l">2169: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#2170" id="2170" class="l">2170: </a>    <span class="php-comment">// CLASS METHODS, MISCELLANEOUS</span>
<a href="#2171" id="2171" class="l">2171: </a>    <span class="php-comment">/////////////////////////////////////////////////</span>
<a href="#2172" id="2172" class="l">2172: </a>
<a href="#2173" id="2173" class="l">2173: </a>    <span class="php-comment">/**
</span><a href="#2174" id="2174" class="l">2174: </a><span class="php-comment">     * Adds the error message to the error container.
</span><a href="#2175" id="2175" class="l">2175: </a><span class="php-comment">     * @access protected
</span><a href="#2176" id="2176" class="l">2176: </a><span class="php-comment">     * @return void
</span><a href="#2177" id="2177" class="l">2177: </a><span class="php-comment">     */</span>
<a href="#2178" id="2178" class="l">2178: </a>
<a href="#2179" id="2179" class="l">2179: </a>    <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> SetError(<span class="php-var">$msg</span>)
<a href="#2180" id="2180" class="l">2180: </a>    {
<a href="#2181" id="2181" class="l">2181: </a>        <span class="php-var">$this</span>-&gt;error_count++;
<a href="#2182" id="2182" class="l">2182: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;Mailer == <span class="php-quote">'smtp'</span> <span class="php-keyword1">and</span> !<span class="php-keyword2">is_null</span>(<span class="php-var">$this</span>-&gt;smtp)) {
<a href="#2183" id="2183" class="l">2183: </a>            <span class="php-var">$lasterror</span> = <span class="php-var">$this</span>-&gt;smtp
<a href="#2184" id="2184" class="l">2184: </a>                    -&gt;getError();
<a href="#2185" id="2185" class="l">2185: </a>            <span class="php-keyword1">if</span> (!<span class="php-keyword1">empty</span>(<span class="php-var">$lasterror</span>) <span class="php-keyword1">and</span> <span class="php-keyword2">array_key_exists</span>(<span class="php-quote">'smtp_msg'</span>, <span class="php-var">$lasterror</span>)) {
<a href="#2186" id="2186" class="l">2186: </a>                <span class="php-var">$msg</span> .= <span class="php-quote">'&lt;p&gt;'</span> . <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'smtp_error'</span>)
<a href="#2187" id="2187" class="l">2187: </a>                        . <span class="php-var">$lasterror</span>[<span class="php-quote">'smtp_msg'</span>] . <span class="php-quote">&quot;&lt;/p&gt;\n&quot;</span>;
<a href="#2188" id="2188" class="l">2188: </a>            }
<a href="#2189" id="2189" class="l">2189: </a>        }
<a href="#2190" id="2190" class="l">2190: </a>        <span class="php-var">$this</span>-&gt;ErrorInfo = <span class="php-var">$msg</span>;
<a href="#2191" id="2191" class="l">2191: </a>    }
<a href="#2192" id="2192" class="l">2192: </a>
<a href="#2193" id="2193" class="l">2193: </a>    <span class="php-comment">/**
</span><a href="#2194" id="2194" class="l">2194: </a><span class="php-comment">     * Returns the proper RFC 822 formatted date.
</span><a href="#2195" id="2195" class="l">2195: </a><span class="php-comment">     * @access public
</span><a href="#2196" id="2196" class="l">2196: </a><span class="php-comment">     * @return string
</span><a href="#2197" id="2197" class="l">2197: </a><span class="php-comment">     * @static
</span><a href="#2198" id="2198" class="l">2198: </a><span class="php-comment">     */</span>
<a href="#2199" id="2199" class="l">2199: </a>
<a href="#2200" id="2200" class="l">2200: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> RFCDate()
<a href="#2201" id="2201" class="l">2201: </a>    {
<a href="#2202" id="2202" class="l">2202: </a>        <span class="php-var">$tz</span> = <span class="php-keyword2">date</span>(<span class="php-quote">'Z'</span>);
<a href="#2203" id="2203" class="l">2203: </a>        <span class="php-var">$tzs</span> = (<span class="php-var">$tz</span> &lt; <span class="php-num">0</span>) ? <span class="php-quote">'-'</span> : <span class="php-quote">'+'</span>;
<a href="#2204" id="2204" class="l">2204: </a>        <span class="php-var">$tz</span> = <span class="php-keyword2">abs</span>(<span class="php-var">$tz</span>);
<a href="#2205" id="2205" class="l">2205: </a>        <span class="php-var">$tz</span> = (int) (<span class="php-var">$tz</span> / <span class="php-num">3600</span>) * <span class="php-num">100</span> + (<span class="php-var">$tz</span> % <span class="php-num">3600</span>) / <span class="php-num">60</span>;
<a href="#2206" id="2206" class="l">2206: </a>        <span class="php-var">$result</span> = <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;%s %s%04d&quot;</span>, <span class="php-keyword2">date</span>(<span class="php-quote">'D, j M Y H:i:s'</span>), <span class="php-var">$tzs</span>, <span class="php-var">$tz</span>);
<a href="#2207" id="2207" class="l">2207: </a>
<a href="#2208" id="2208" class="l">2208: </a>        <span class="php-keyword1">return</span> <span class="php-var">$result</span>;
<a href="#2209" id="2209" class="l">2209: </a>    }
<a href="#2210" id="2210" class="l">2210: </a>
<a href="#2211" id="2211" class="l">2211: </a>    <span class="php-comment">/**
</span><a href="#2212" id="2212" class="l">2212: </a><span class="php-comment">     * Returns the server hostname or 'localhost.localdomain' if unknown.
</span><a href="#2213" id="2213" class="l">2213: </a><span class="php-comment">     * @access private
</span><a href="#2214" id="2214" class="l">2214: </a><span class="php-comment">     * @return string
</span><a href="#2215" id="2215" class="l">2215: </a><span class="php-comment">     */</span>
<a href="#2216" id="2216" class="l">2216: </a>
<a href="#2217" id="2217" class="l">2217: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> ServerHostname()
<a href="#2218" id="2218" class="l">2218: </a>    {
<a href="#2219" id="2219" class="l">2219: </a>        <span class="php-keyword1">if</span> (!<span class="php-keyword1">empty</span>(<span class="php-var">$this</span>-&gt;Hostname)) {
<a href="#2220" id="2220" class="l">2220: </a>            <span class="php-var">$result</span> = <span class="php-var">$this</span>-&gt;Hostname;
<a href="#2221" id="2221" class="l">2221: </a>        } <span class="php-keyword1">elseif</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$_SERVER</span>[<span class="php-quote">'SERVER_NAME'</span>])) {
<a href="#2222" id="2222" class="l">2222: </a>            <span class="php-var">$result</span> = <span class="php-var">$_SERVER</span>[<span class="php-quote">'SERVER_NAME'</span>];
<a href="#2223" id="2223" class="l">2223: </a>        } <span class="php-keyword1">else</span> {
<a href="#2224" id="2224" class="l">2224: </a>            <span class="php-var">$result</span> = <span class="php-quote">'localhost.localdomain'</span>;
<a href="#2225" id="2225" class="l">2225: </a>        }
<a href="#2226" id="2226" class="l">2226: </a>
<a href="#2227" id="2227" class="l">2227: </a>        <span class="php-keyword1">return</span> <span class="php-var">$result</span>;
<a href="#2228" id="2228" class="l">2228: </a>    }
<a href="#2229" id="2229" class="l">2229: </a>
<a href="#2230" id="2230" class="l">2230: </a>    <span class="php-comment">/**
</span><a href="#2231" id="2231" class="l">2231: </a><span class="php-comment">     * Returns a message in the appropriate language.
</span><a href="#2232" id="2232" class="l">2232: </a><span class="php-comment">     * @access private
</span><a href="#2233" id="2233" class="l">2233: </a><span class="php-comment">     * @return string
</span><a href="#2234" id="2234" class="l">2234: </a><span class="php-comment">     */</span>
<a href="#2235" id="2235" class="l">2235: </a>
<a href="#2236" id="2236" class="l">2236: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> Lang(<span class="php-var">$key</span>)
<a href="#2237" id="2237" class="l">2237: </a>    {
<a href="#2238" id="2238" class="l">2238: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">count</span>(<span class="php-var">$this</span>-&gt;language) &lt; <span class="php-num">1</span>) {
<a href="#2239" id="2239" class="l">2239: </a>            <span class="php-var">$this</span>-&gt;SetLanguage(<span class="php-quote">'en'</span>); <span class="php-comment">// set the default language</span>
<a href="#2240" id="2240" class="l">2240: </a>        }
<a href="#2241" id="2241" class="l">2241: </a>
<a href="#2242" id="2242" class="l">2242: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>-&gt;language[<span class="php-var">$key</span>])) {
<a href="#2243" id="2243" class="l">2243: </a>            <span class="php-keyword1">return</span> <span class="php-var">$this</span>-&gt;language[<span class="php-var">$key</span>];
<a href="#2244" id="2244" class="l">2244: </a>        } <span class="php-keyword1">else</span> {
<a href="#2245" id="2245" class="l">2245: </a>            <span class="php-keyword1">return</span> <span class="php-quote">'Language string failed to load: '</span> . <span class="php-var">$key</span>;
<a href="#2246" id="2246" class="l">2246: </a>        }
<a href="#2247" id="2247" class="l">2247: </a>    }
<a href="#2248" id="2248" class="l">2248: </a>
<a href="#2249" id="2249" class="l">2249: </a>    <span class="php-comment">/**
</span><a href="#2250" id="2250" class="l">2250: </a><span class="php-comment">     * Returns TRUE if an error occurred.
</span><a href="#2251" id="2251" class="l">2251: </a><span class="php-comment">     * @access public
</span><a href="#2252" id="2252" class="l">2252: </a><span class="php-comment">     * @return bool
</span><a href="#2253" id="2253" class="l">2253: </a><span class="php-comment">     */</span>
<a href="#2254" id="2254" class="l">2254: </a>
<a href="#2255" id="2255" class="l">2255: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> IsError()
<a href="#2256" id="2256" class="l">2256: </a>    {
<a href="#2257" id="2257" class="l">2257: </a>        <span class="php-keyword1">return</span> (<span class="php-var">$this</span>-&gt;error_count &gt; <span class="php-num">0</span>);
<a href="#2258" id="2258" class="l">2258: </a>    }
<a href="#2259" id="2259" class="l">2259: </a>
<a href="#2260" id="2260" class="l">2260: </a>    <span class="php-comment">/**
</span><a href="#2261" id="2261" class="l">2261: </a><span class="php-comment">     * Changes every end of line from CR or LF to CRLF.
</span><a href="#2262" id="2262" class="l">2262: </a><span class="php-comment">     * @access private
</span><a href="#2263" id="2263" class="l">2263: </a><span class="php-comment">     * @return string
</span><a href="#2264" id="2264" class="l">2264: </a><span class="php-comment">     */</span>
<a href="#2265" id="2265" class="l">2265: </a>
<a href="#2266" id="2266" class="l">2266: </a>    <span class="php-keyword1">private</span> <span class="php-keyword1">function</span> FixEOL(<span class="php-var">$str</span>)
<a href="#2267" id="2267" class="l">2267: </a>    {
<a href="#2268" id="2268" class="l">2268: </a>        <span class="php-var">$str</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\r\n&quot;</span>, <span class="php-quote">&quot;\n&quot;</span>, <span class="php-var">$str</span>);
<a href="#2269" id="2269" class="l">2269: </a>        <span class="php-var">$str</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\r&quot;</span>, <span class="php-quote">&quot;\n&quot;</span>, <span class="php-var">$str</span>);
<a href="#2270" id="2270" class="l">2270: </a>        <span class="php-var">$str</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\n&quot;</span>, <span class="php-var">$this</span>-&gt;LE, <span class="php-var">$str</span>);
<a href="#2271" id="2271" class="l">2271: </a>        <span class="php-keyword1">return</span> <span class="php-var">$str</span>;
<a href="#2272" id="2272" class="l">2272: </a>    }
<a href="#2273" id="2273" class="l">2273: </a>
<a href="#2274" id="2274" class="l">2274: </a>    <span class="php-comment">/**
</span><a href="#2275" id="2275" class="l">2275: </a><span class="php-comment">     * Adds a custom header.
</span><a href="#2276" id="2276" class="l">2276: </a><span class="php-comment">     * @access public
</span><a href="#2277" id="2277" class="l">2277: </a><span class="php-comment">     * @return void
</span><a href="#2278" id="2278" class="l">2278: </a><span class="php-comment">     */</span>
<a href="#2279" id="2279" class="l">2279: </a>
<a href="#2280" id="2280" class="l">2280: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> AddCustomHeader(<span class="php-var">$custom_header</span>)
<a href="#2281" id="2281" class="l">2281: </a>    {
<a href="#2282" id="2282" class="l">2282: </a>        <span class="php-var">$this</span>-&gt;CustomHeader[] = <span class="php-keyword2">explode</span>(<span class="php-quote">':'</span>, <span class="php-var">$custom_header</span>, <span class="php-num">2</span>);
<a href="#2283" id="2283" class="l">2283: </a>    }
<a href="#2284" id="2284" class="l">2284: </a>
<a href="#2285" id="2285" class="l">2285: </a>    <span class="php-comment">/**
</span><a href="#2286" id="2286" class="l">2286: </a><span class="php-comment">     * Evaluates the message and returns modifications for inline images and backgrounds
</span><a href="#2287" id="2287" class="l">2287: </a><span class="php-comment">     * @access public
</span><a href="#2288" id="2288" class="l">2288: </a><span class="php-comment">     * @return $message
</span><a href="#2289" id="2289" class="l">2289: </a><span class="php-comment">     */</span>
<a href="#2290" id="2290" class="l">2290: </a>
<a href="#2291" id="2291" class="l">2291: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> MsgHTML(<span class="php-var">$message</span>, <span class="php-var">$basedir</span> = <span class="php-quote">''</span>)
<a href="#2292" id="2292" class="l">2292: </a>    {
<a href="#2293" id="2293" class="l">2293: </a>        <span class="php-keyword2">preg_match_all</span>(<span class="php-quote">&quot;/(src|background)=\&quot;(.*)\&quot;/Ui&quot;</span>, <span class="php-var">$message</span>, <span class="php-var">$images</span>);
<a href="#2294" id="2294" class="l">2294: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$images</span>[<span class="php-num">2</span>])) {
<a href="#2295" id="2295" class="l">2295: </a>            <span class="php-keyword1">foreach</span> (<span class="php-var">$images</span>[<span class="php-num">2</span>] <span class="php-keyword1">as</span> <span class="php-var">$i</span> =&gt; <span class="php-var">$url</span>) {
<a href="#2296" id="2296" class="l">2296: </a>                <span class="php-comment">// do not change urls for absolute images (thanks to corvuscorax)</span>
<a href="#2297" id="2297" class="l">2297: </a>                <span class="php-keyword1">if</span> (!<span class="php-keyword2">preg_match</span>(<span class="php-quote">'#^[A-z]+://#'</span>, <span class="php-var">$url</span>)) {
<a href="#2298" id="2298" class="l">2298: </a>                    <span class="php-var">$filename</span> = <span class="php-keyword2">basename</span>(<span class="php-var">$url</span>);
<a href="#2299" id="2299" class="l">2299: </a>                    <span class="php-var">$directory</span> = <span class="php-keyword2">dirname</span>(<span class="php-var">$url</span>);
<a href="#2300" id="2300" class="l">2300: </a>                    (<span class="php-var">$directory</span> == <span class="php-quote">'.'</span>) ? <span class="php-var">$directory</span> = <span class="php-quote">''</span> : <span class="php-quote">''</span>;
<a href="#2301" id="2301" class="l">2301: </a>                    <span class="php-var">$cid</span> = <span class="php-quote">'cid:'</span> . <span class="php-keyword2">md5</span>(<span class="php-var">$filename</span>);
<a href="#2302" id="2302" class="l">2302: </a>                    <span class="php-var">$ext</span> = <span class="php-keyword2">pathinfo</span>(<span class="php-var">$filename</span>, PATHINFO_EXTENSION);
<a href="#2303" id="2303" class="l">2303: </a>                    <span class="php-var">$mimeType</span> = self::_mime_types(<span class="php-var">$ext</span>);
<a href="#2304" id="2304" class="l">2304: </a>                    <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$basedir</span>) &gt; <span class="php-num">1</span> &amp;&amp; <span class="php-keyword2">substr</span>(<span class="php-var">$basedir</span>, -<span class="php-num">1</span>) != <span class="php-quote">'/'</span>) {
<a href="#2305" id="2305" class="l">2305: </a>                        <span class="php-var">$basedir</span> .= <span class="php-quote">'/'</span>;
<a href="#2306" id="2306" class="l">2306: </a>                    }
<a href="#2307" id="2307" class="l">2307: </a>                    <span class="php-keyword1">if</span> (<span class="php-keyword2">strlen</span>(<span class="php-var">$directory</span>) &gt; <span class="php-num">1</span> &amp;&amp; <span class="php-keyword2">substr</span>(<span class="php-var">$directory</span>, -<span class="php-num">1</span>) != <span class="php-quote">'/'</span>) {
<a href="#2308" id="2308" class="l">2308: </a>                        <span class="php-var">$directory</span> .= <span class="php-quote">'/'</span>;
<a href="#2309" id="2309" class="l">2309: </a>                    }
<a href="#2310" id="2310" class="l">2310: </a>                    <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;AddEmbeddedImage(
<a href="#2311" id="2311" class="l">2311: </a>                                    <span class="php-var">$basedir</span> . <span class="php-var">$directory</span> . <span class="php-var">$filename</span>,
<a href="#2312" id="2312" class="l">2312: </a>                                    <span class="php-keyword2">md5</span>(<span class="php-var">$filename</span>), <span class="php-var">$filename</span>, <span class="php-quote">'base64'</span>,
<a href="#2313" id="2313" class="l">2313: </a>                                    <span class="php-var">$mimeType</span>)) {
<a href="#2314" id="2314" class="l">2314: </a>                        <span class="php-var">$message</span> = <span class="php-keyword2">preg_replace</span>(
<a href="#2315" id="2315" class="l">2315: </a>                                <span class="php-quote">&quot;/&quot;</span> . <span class="php-var">$images</span>[<span class="php-num">1</span>][<span class="php-var">$i</span>] . <span class="php-quote">&quot;=\&quot;&quot;</span>
<a href="#2316" id="2316" class="l">2316: </a>                                        . <span class="php-keyword2">preg_quote</span>(<span class="php-var">$url</span>, <span class="php-quote">'/'</span>) . <span class="php-quote">&quot;\&quot;/Ui&quot;</span>,
<a href="#2317" id="2317" class="l">2317: </a>                                <span class="php-var">$images</span>[<span class="php-num">1</span>][<span class="php-var">$i</span>] . <span class="php-quote">&quot;=\&quot;&quot;</span> . <span class="php-var">$cid</span> . <span class="php-quote">&quot;\&quot;&quot;</span>, <span class="php-var">$message</span>);
<a href="#2318" id="2318" class="l">2318: </a>                    }
<a href="#2319" id="2319" class="l">2319: </a>                }
<a href="#2320" id="2320" class="l">2320: </a>            }
<a href="#2321" id="2321" class="l">2321: </a>        }
<a href="#2322" id="2322" class="l">2322: </a>        <span class="php-var">$this</span>-&gt;IsHTML(<span class="php-keyword1">TRUE</span>);
<a href="#2323" id="2323" class="l">2323: </a>        <span class="php-var">$this</span>-&gt;Body = <span class="php-var">$message</span>;
<a href="#2324" id="2324" class="l">2324: </a>        <span class="php-var">$textMsg</span> = <span class="php-keyword2">trim</span>(
<a href="#2325" id="2325" class="l">2325: </a>                <span class="php-keyword2">strip_tags</span>(
<a href="#2326" id="2326" class="l">2326: </a>                        <span class="php-keyword2">preg_replace</span>(
<a href="#2327" id="2327" class="l">2327: </a>                                <span class="php-quote">'/&lt;(head|title|style|script)[^&gt;]*&gt;.*?&lt;\/\\1&gt;/s'</span>,
<a href="#2328" id="2328" class="l">2328: </a>                                <span class="php-quote">''</span>, <span class="php-var">$message</span>)));
<a href="#2329" id="2329" class="l">2329: </a>        <span class="php-keyword1">if</span> (!<span class="php-keyword1">empty</span>(<span class="php-var">$textMsg</span>) &amp;&amp; <span class="php-keyword1">empty</span>(<span class="php-var">$this</span>-&gt;AltBody)) {
<a href="#2330" id="2330" class="l">2330: </a>            <span class="php-var">$this</span>-&gt;AltBody = <span class="php-keyword2">html_entity_decode</span>(<span class="php-var">$textMsg</span>);
<a href="#2331" id="2331" class="l">2331: </a>        }
<a href="#2332" id="2332" class="l">2332: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword1">empty</span>(<span class="php-var">$this</span>-&gt;AltBody)) {
<a href="#2333" id="2333" class="l">2333: </a>            <span class="php-var">$this</span>-&gt;AltBody = <span class="php-quote">'To view this email message, open it in a program that understands HTML!'</span>
<a href="#2334" id="2334" class="l">2334: </a>                    . <span class="php-quote">&quot;\n\n&quot;</span>;
<a href="#2335" id="2335" class="l">2335: </a>        }
<a href="#2336" id="2336" class="l">2336: </a>    }
<a href="#2337" id="2337" class="l">2337: </a>
<a href="#2338" id="2338" class="l">2338: </a>    <span class="php-comment">/**
</span><a href="#2339" id="2339" class="l">2339: </a><span class="php-comment">     * Gets the MIME type of the embedded or inline image
</span><a href="#2340" id="2340" class="l">2340: </a><span class="php-comment">     * @param string File extension
</span><a href="#2341" id="2341" class="l">2341: </a><span class="php-comment">     * @access public
</span><a href="#2342" id="2342" class="l">2342: </a><span class="php-comment">     * @return string MIME type of ext
</span><a href="#2343" id="2343" class="l">2343: </a><span class="php-comment">     * @static
</span><a href="#2344" id="2344" class="l">2344: </a><span class="php-comment">     */</span>
<a href="#2345" id="2345" class="l">2345: </a>
<a href="#2346" id="2346" class="l">2346: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">static</span> <span class="php-keyword1">function</span> _mime_types(<span class="php-var">$ext</span> = <span class="php-quote">''</span>)
<a href="#2347" id="2347" class="l">2347: </a>    {
<a href="#2348" id="2348" class="l">2348: </a>        <span class="php-var">$mimes</span> = <span class="php-keyword1">array</span>(
<a href="#2349" id="2349" class="l">2349: </a>                <span class="php-quote">'hqx'</span> =&gt; <span class="php-quote">'application/mac-binhex40'</span>,
<a href="#2350" id="2350" class="l">2350: </a>                <span class="php-quote">'cpt'</span> =&gt; <span class="php-quote">'application/mac-compactpro'</span>,
<a href="#2351" id="2351" class="l">2351: </a>                <span class="php-quote">'doc'</span> =&gt; <span class="php-quote">'application/msword'</span>,
<a href="#2352" id="2352" class="l">2352: </a>                <span class="php-quote">'bin'</span> =&gt; <span class="php-quote">'application/macbinary'</span>,
<a href="#2353" id="2353" class="l">2353: </a>                <span class="php-quote">'dms'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2354" id="2354" class="l">2354: </a>                <span class="php-quote">'lha'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2355" id="2355" class="l">2355: </a>                <span class="php-quote">'lzh'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2356" id="2356" class="l">2356: </a>                <span class="php-quote">'exe'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2357" id="2357" class="l">2357: </a>                <span class="php-quote">'class'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2358" id="2358" class="l">2358: </a>                <span class="php-quote">'psd'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2359" id="2359" class="l">2359: </a>                <span class="php-quote">'so'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2360" id="2360" class="l">2360: </a>                <span class="php-quote">'sea'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2361" id="2361" class="l">2361: </a>                <span class="php-quote">'dll'</span> =&gt; <span class="php-quote">'application/octet-stream'</span>,
<a href="#2362" id="2362" class="l">2362: </a>                <span class="php-quote">'oda'</span> =&gt; <span class="php-quote">'application/oda'</span>,
<a href="#2363" id="2363" class="l">2363: </a>                <span class="php-quote">'pdf'</span> =&gt; <span class="php-quote">'application/pdf'</span>,
<a href="#2364" id="2364" class="l">2364: </a>                <span class="php-quote">'ai'</span> =&gt; <span class="php-quote">'application/postscript'</span>,
<a href="#2365" id="2365" class="l">2365: </a>                <span class="php-quote">'eps'</span> =&gt; <span class="php-quote">'application/postscript'</span>,
<a href="#2366" id="2366" class="l">2366: </a>                <span class="php-quote">'ps'</span> =&gt; <span class="php-quote">'application/postscript'</span>,
<a href="#2367" id="2367" class="l">2367: </a>                <span class="php-quote">'smi'</span> =&gt; <span class="php-quote">'application/smil'</span>,
<a href="#2368" id="2368" class="l">2368: </a>                <span class="php-quote">'smil'</span> =&gt; <span class="php-quote">'application/smil'</span>,
<a href="#2369" id="2369" class="l">2369: </a>                <span class="php-quote">'mif'</span> =&gt; <span class="php-quote">'application/vnd.mif'</span>,
<a href="#2370" id="2370" class="l">2370: </a>                <span class="php-quote">'xls'</span> =&gt; <span class="php-quote">'application/vnd.ms-excel'</span>,
<a href="#2371" id="2371" class="l">2371: </a>                <span class="php-quote">'ppt'</span> =&gt; <span class="php-quote">'application/vnd.ms-powerpoint'</span>,
<a href="#2372" id="2372" class="l">2372: </a>                <span class="php-quote">'wbxml'</span> =&gt; <span class="php-quote">'application/vnd.wap.wbxml'</span>,
<a href="#2373" id="2373" class="l">2373: </a>                <span class="php-quote">'wmlc'</span> =&gt; <span class="php-quote">'application/vnd.wap.wmlc'</span>,
<a href="#2374" id="2374" class="l">2374: </a>                <span class="php-quote">'dcr'</span> =&gt; <span class="php-quote">'application/x-director'</span>,
<a href="#2375" id="2375" class="l">2375: </a>                <span class="php-quote">'dir'</span> =&gt; <span class="php-quote">'application/x-director'</span>,
<a href="#2376" id="2376" class="l">2376: </a>                <span class="php-quote">'dxr'</span> =&gt; <span class="php-quote">'application/x-director'</span>,
<a href="#2377" id="2377" class="l">2377: </a>                <span class="php-quote">'dvi'</span> =&gt; <span class="php-quote">'application/x-dvi'</span>,
<a href="#2378" id="2378" class="l">2378: </a>                <span class="php-quote">'gtar'</span> =&gt; <span class="php-quote">'application/x-gtar'</span>,
<a href="#2379" id="2379" class="l">2379: </a>                <span class="php-quote">'php'</span> =&gt; <span class="php-quote">'application/x-httpd-php'</span>,
<a href="#2380" id="2380" class="l">2380: </a>                <span class="php-quote">'php4'</span> =&gt; <span class="php-quote">'application/x-httpd-php'</span>,
<a href="#2381" id="2381" class="l">2381: </a>                <span class="php-quote">'php3'</span> =&gt; <span class="php-quote">'application/x-httpd-php'</span>,
<a href="#2382" id="2382" class="l">2382: </a>                <span class="php-quote">'phtml'</span> =&gt; <span class="php-quote">'application/x-httpd-php'</span>,
<a href="#2383" id="2383" class="l">2383: </a>                <span class="php-quote">'phps'</span> =&gt; <span class="php-quote">'application/x-httpd-php-source'</span>,
<a href="#2384" id="2384" class="l">2384: </a>                <span class="php-quote">'js'</span> =&gt; <span class="php-quote">'application/x-javascript'</span>,
<a href="#2385" id="2385" class="l">2385: </a>                <span class="php-quote">'swf'</span> =&gt; <span class="php-quote">'application/x-shockwave-flash'</span>,
<a href="#2386" id="2386" class="l">2386: </a>                <span class="php-quote">'sit'</span> =&gt; <span class="php-quote">'application/x-stuffit'</span>,
<a href="#2387" id="2387" class="l">2387: </a>                <span class="php-quote">'tar'</span> =&gt; <span class="php-quote">'application/x-tar'</span>,
<a href="#2388" id="2388" class="l">2388: </a>                <span class="php-quote">'tgz'</span> =&gt; <span class="php-quote">'application/x-tar'</span>,
<a href="#2389" id="2389" class="l">2389: </a>                <span class="php-quote">'xhtml'</span> =&gt; <span class="php-quote">'application/xhtml+xml'</span>,
<a href="#2390" id="2390" class="l">2390: </a>                <span class="php-quote">'xht'</span> =&gt; <span class="php-quote">'application/xhtml+xml'</span>,
<a href="#2391" id="2391" class="l">2391: </a>                <span class="php-quote">'zip'</span> =&gt; <span class="php-quote">'application/zip'</span>,
<a href="#2392" id="2392" class="l">2392: </a>                <span class="php-quote">'mid'</span> =&gt; <span class="php-quote">'audio/midi'</span>,
<a href="#2393" id="2393" class="l">2393: </a>                <span class="php-quote">'midi'</span> =&gt; <span class="php-quote">'audio/midi'</span>,
<a href="#2394" id="2394" class="l">2394: </a>                <span class="php-quote">'mpga'</span> =&gt; <span class="php-quote">'audio/mpeg'</span>,
<a href="#2395" id="2395" class="l">2395: </a>                <span class="php-quote">'mp2'</span> =&gt; <span class="php-quote">'audio/mpeg'</span>,
<a href="#2396" id="2396" class="l">2396: </a>                <span class="php-quote">'mp3'</span> =&gt; <span class="php-quote">'audio/mpeg'</span>,
<a href="#2397" id="2397" class="l">2397: </a>                <span class="php-quote">'aif'</span> =&gt; <span class="php-quote">'audio/x-aiff'</span>,
<a href="#2398" id="2398" class="l">2398: </a>                <span class="php-quote">'aiff'</span> =&gt; <span class="php-quote">'audio/x-aiff'</span>,
<a href="#2399" id="2399" class="l">2399: </a>                <span class="php-quote">'aifc'</span> =&gt; <span class="php-quote">'audio/x-aiff'</span>,
<a href="#2400" id="2400" class="l">2400: </a>                <span class="php-quote">'ram'</span> =&gt; <span class="php-quote">'audio/x-pn-realaudio'</span>,
<a href="#2401" id="2401" class="l">2401: </a>                <span class="php-quote">'rm'</span> =&gt; <span class="php-quote">'audio/x-pn-realaudio'</span>,
<a href="#2402" id="2402" class="l">2402: </a>                <span class="php-quote">'rpm'</span> =&gt; <span class="php-quote">'audio/x-pn-realaudio-plugin'</span>,
<a href="#2403" id="2403" class="l">2403: </a>                <span class="php-quote">'ra'</span> =&gt; <span class="php-quote">'audio/x-realaudio'</span>,
<a href="#2404" id="2404" class="l">2404: </a>                <span class="php-quote">'rv'</span> =&gt; <span class="php-quote">'video/vnd.rn-realvideo'</span>,
<a href="#2405" id="2405" class="l">2405: </a>                <span class="php-quote">'wav'</span> =&gt; <span class="php-quote">'audio/x-wav'</span>,
<a href="#2406" id="2406" class="l">2406: </a>                <span class="php-quote">'bmp'</span> =&gt; <span class="php-quote">'image/bmp'</span>,
<a href="#2407" id="2407" class="l">2407: </a>                <span class="php-quote">'gif'</span> =&gt; <span class="php-quote">'image/gif'</span>,
<a href="#2408" id="2408" class="l">2408: </a>                <span class="php-quote">'jpeg'</span> =&gt; <span class="php-quote">'image/jpeg'</span>,
<a href="#2409" id="2409" class="l">2409: </a>                <span class="php-quote">'jpg'</span> =&gt; <span class="php-quote">'image/jpeg'</span>,
<a href="#2410" id="2410" class="l">2410: </a>                <span class="php-quote">'jpe'</span> =&gt; <span class="php-quote">'image/jpeg'</span>,
<a href="#2411" id="2411" class="l">2411: </a>                <span class="php-quote">'png'</span> =&gt; <span class="php-quote">'image/png'</span>,
<a href="#2412" id="2412" class="l">2412: </a>                <span class="php-quote">'tiff'</span> =&gt; <span class="php-quote">'image/tiff'</span>,
<a href="#2413" id="2413" class="l">2413: </a>                <span class="php-quote">'tif'</span> =&gt; <span class="php-quote">'image/tiff'</span>,
<a href="#2414" id="2414" class="l">2414: </a>                <span class="php-quote">'css'</span> =&gt; <span class="php-quote">'text/css'</span>,
<a href="#2415" id="2415" class="l">2415: </a>                <span class="php-quote">'html'</span> =&gt; <span class="php-quote">'text/html'</span>,
<a href="#2416" id="2416" class="l">2416: </a>                <span class="php-quote">'htm'</span> =&gt; <span class="php-quote">'text/html'</span>,
<a href="#2417" id="2417" class="l">2417: </a>                <span class="php-quote">'shtml'</span> =&gt; <span class="php-quote">'text/html'</span>,
<a href="#2418" id="2418" class="l">2418: </a>                <span class="php-quote">'txt'</span> =&gt; <span class="php-quote">'text/plain'</span>,
<a href="#2419" id="2419" class="l">2419: </a>                <span class="php-quote">'text'</span> =&gt; <span class="php-quote">'text/plain'</span>,
<a href="#2420" id="2420" class="l">2420: </a>                <span class="php-quote">'log'</span> =&gt; <span class="php-quote">'text/plain'</span>,
<a href="#2421" id="2421" class="l">2421: </a>                <span class="php-quote">'rtx'</span> =&gt; <span class="php-quote">'text/richtext'</span>,
<a href="#2422" id="2422" class="l">2422: </a>                <span class="php-quote">'rtf'</span> =&gt; <span class="php-quote">'text/rtf'</span>,
<a href="#2423" id="2423" class="l">2423: </a>                <span class="php-quote">'xml'</span> =&gt; <span class="php-quote">'text/xml'</span>,
<a href="#2424" id="2424" class="l">2424: </a>                <span class="php-quote">'xsl'</span> =&gt; <span class="php-quote">'text/xml'</span>,
<a href="#2425" id="2425" class="l">2425: </a>                <span class="php-quote">'mpeg'</span> =&gt; <span class="php-quote">'video/mpeg'</span>,
<a href="#2426" id="2426" class="l">2426: </a>                <span class="php-quote">'mpg'</span> =&gt; <span class="php-quote">'video/mpeg'</span>,
<a href="#2427" id="2427" class="l">2427: </a>                <span class="php-quote">'mpe'</span> =&gt; <span class="php-quote">'video/mpeg'</span>,
<a href="#2428" id="2428" class="l">2428: </a>                <span class="php-quote">'qt'</span> =&gt; <span class="php-quote">'video/quicktime'</span>,
<a href="#2429" id="2429" class="l">2429: </a>                <span class="php-quote">'mov'</span> =&gt; <span class="php-quote">'video/quicktime'</span>,
<a href="#2430" id="2430" class="l">2430: </a>                <span class="php-quote">'avi'</span> =&gt; <span class="php-quote">'video/x-msvideo'</span>,
<a href="#2431" id="2431" class="l">2431: </a>                <span class="php-quote">'movie'</span> =&gt; <span class="php-quote">'video/x-sgi-movie'</span>,
<a href="#2432" id="2432" class="l">2432: </a>                <span class="php-quote">'doc'</span> =&gt; <span class="php-quote">'application/msword'</span>,
<a href="#2433" id="2433" class="l">2433: </a>                <span class="php-quote">'word'</span> =&gt; <span class="php-quote">'application/msword'</span>,
<a href="#2434" id="2434" class="l">2434: </a>                <span class="php-quote">'xl'</span> =&gt; <span class="php-quote">'application/excel'</span>,
<a href="#2435" id="2435" class="l">2435: </a>                <span class="php-quote">'eml'</span> =&gt; <span class="php-quote">'message/rfc822'</span>
<a href="#2436" id="2436" class="l">2436: </a>        );
<a href="#2437" id="2437" class="l">2437: </a>        <span class="php-keyword1">return</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$mimes</span>[<span class="php-keyword2">strtolower</span>(<span class="php-var">$ext</span>)])) ? <span class="php-quote">'application/octet-stream'</span>
<a href="#2438" id="2438" class="l">2438: </a>                : <span class="php-var">$mimes</span>[<span class="php-keyword2">strtolower</span>(<span class="php-var">$ext</span>)];
<a href="#2439" id="2439" class="l">2439: </a>    }
<a href="#2440" id="2440" class="l">2440: </a>
<a href="#2441" id="2441" class="l">2441: </a>    <span class="php-comment">/**
</span><a href="#2442" id="2442" class="l">2442: </a><span class="php-comment">     * Set (or reset) Class Objects (variables)
</span><a href="#2443" id="2443" class="l">2443: </a><span class="php-comment">     *
</span><a href="#2444" id="2444" class="l">2444: </a><span class="php-comment">     * Usage Example:
</span><a href="#2445" id="2445" class="l">2445: </a><span class="php-comment">     * $page-&gt;set('X-Priority', '3');
</span><a href="#2446" id="2446" class="l">2446: </a><span class="php-comment">     *
</span><a href="#2447" id="2447" class="l">2447: </a><span class="php-comment">     * @access public
</span><a href="#2448" id="2448" class="l">2448: </a><span class="php-comment">     * @param string $name Parameter Name
</span><a href="#2449" id="2449" class="l">2449: </a><span class="php-comment">     * @param mixed $value Parameter Value
</span><a href="#2450" id="2450" class="l">2450: </a><span class="php-comment">     * NOTE: will not work with arrays, there are no arrays to set/reset
</span><a href="#2451" id="2451" class="l">2451: </a><span class="php-comment">     * @todo Should this not be using __set() magic function?
</span><a href="#2452" id="2452" class="l">2452: </a><span class="php-comment">     */</span>
<a href="#2453" id="2453" class="l">2453: </a>
<a href="#2454" id="2454" class="l">2454: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> set(<span class="php-var">$name</span>, <span class="php-var">$value</span> = <span class="php-quote">''</span>)
<a href="#2455" id="2455" class="l">2455: </a>    {
<a href="#2456" id="2456" class="l">2456: </a>        <span class="php-keyword1">try</span> {
<a href="#2457" id="2457" class="l">2457: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>-&gt;<span class="php-var">$name</span>)) {
<a href="#2458" id="2458" class="l">2458: </a>                <span class="php-var">$this</span>-&gt;<span class="php-var">$name</span> = <span class="php-var">$value</span>;
<a href="#2459" id="2459" class="l">2459: </a>            } <span class="php-keyword1">else</span> {
<a href="#2460" id="2460" class="l">2460: </a>                <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> phpmailerException(
<a href="#2461" id="2461" class="l">2461: </a>                        <span class="php-var">$this</span>-&gt;Lang(<span class="php-quote">'variable_set'</span>) . <span class="php-var">$name</span>,
<a href="#2462" id="2462" class="l">2462: </a>                        self::STOP_CRITICAL);
<a href="#2463" id="2463" class="l">2463: </a>            }
<a href="#2464" id="2464" class="l">2464: </a>        } <span class="php-keyword1">catch</span> (Exception <span class="php-var">$e</span>) {
<a href="#2465" id="2465" class="l">2465: </a>            <span class="php-var">$this</span>-&gt;SetError(<span class="php-var">$e</span>-&gt;getMessage());
<a href="#2466" id="2466" class="l">2466: </a>            <span class="php-keyword1">if</span> (<span class="php-var">$e</span>-&gt;getCode() == self::STOP_CRITICAL) {
<a href="#2467" id="2467" class="l">2467: </a>                <span class="php-keyword1">return</span> <span class="php-keyword1">FALSE</span>;
<a href="#2468" id="2468" class="l">2468: </a>            }
<a href="#2469" id="2469" class="l">2469: </a>        }
<a href="#2470" id="2470" class="l">2470: </a>        <span class="php-keyword1">return</span> <span class="php-keyword1">TRUE</span>;
<a href="#2471" id="2471" class="l">2471: </a>    }
<a href="#2472" id="2472" class="l">2472: </a>
<a href="#2473" id="2473" class="l">2473: </a>    <span class="php-comment">/**
</span><a href="#2474" id="2474" class="l">2474: </a><span class="php-comment">     * Strips newlines to prevent header injection.
</span><a href="#2475" id="2475" class="l">2475: </a><span class="php-comment">     * @access public
</span><a href="#2476" id="2476" class="l">2476: </a><span class="php-comment">     * @param string $str String
</span><a href="#2477" id="2477" class="l">2477: </a><span class="php-comment">     * @return string
</span><a href="#2478" id="2478" class="l">2478: </a><span class="php-comment">     */</span>
<a href="#2479" id="2479" class="l">2479: </a>
<a href="#2480" id="2480" class="l">2480: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> SecureHeader(<span class="php-var">$str</span>)
<a href="#2481" id="2481" class="l">2481: </a>    {
<a href="#2482" id="2482" class="l">2482: </a>        <span class="php-var">$str</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\r&quot;</span>, <span class="php-quote">''</span>, <span class="php-var">$str</span>);
<a href="#2483" id="2483" class="l">2483: </a>        <span class="php-var">$str</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\n&quot;</span>, <span class="php-quote">''</span>, <span class="php-var">$str</span>);
<a href="#2484" id="2484" class="l">2484: </a>        <span class="php-keyword1">return</span> <span class="php-keyword2">trim</span>(<span class="php-var">$str</span>);
<a href="#2485" id="2485" class="l">2485: </a>    }
<a href="#2486" id="2486" class="l">2486: </a>
<a href="#2487" id="2487" class="l">2487: </a>    <span class="php-comment">/**
</span><a href="#2488" id="2488" class="l">2488: </a><span class="php-comment">     * Set the private key file and password to sign the message.
</span><a href="#2489" id="2489" class="l">2489: </a><span class="php-comment">     *
</span><a href="#2490" id="2490" class="l">2490: </a><span class="php-comment">     * @access public
</span><a href="#2491" id="2491" class="l">2491: </a><span class="php-comment">     * @param string $key_filename Parameter File Name
</span><a href="#2492" id="2492" class="l">2492: </a><span class="php-comment">     * @param string $key_pass Password for private key
</span><a href="#2493" id="2493" class="l">2493: </a><span class="php-comment">     */</span>
<a href="#2494" id="2494" class="l">2494: </a>
<a href="#2495" id="2495" class="l">2495: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> Sign(<span class="php-var">$cert_filename</span>, <span class="php-var">$key_filename</span>, <span class="php-var">$key_pass</span>)
<a href="#2496" id="2496" class="l">2496: </a>    {
<a href="#2497" id="2497" class="l">2497: </a>        <span class="php-var">$this</span>-&gt;sign_cert_file = <span class="php-var">$cert_filename</span>;
<a href="#2498" id="2498" class="l">2498: </a>        <span class="php-var">$this</span>-&gt;sign_key_file = <span class="php-var">$key_filename</span>;
<a href="#2499" id="2499" class="l">2499: </a>        <span class="php-var">$this</span>-&gt;sign_key_pass = <span class="php-var">$key_pass</span>;
<a href="#2500" id="2500" class="l">2500: </a>    }
<a href="#2501" id="2501" class="l">2501: </a>
<a href="#2502" id="2502" class="l">2502: </a>    <span class="php-comment">/**
</span><a href="#2503" id="2503" class="l">2503: </a><span class="php-comment">     * Set the private key file and password to sign the message.
</span><a href="#2504" id="2504" class="l">2504: </a><span class="php-comment">     *
</span><a href="#2505" id="2505" class="l">2505: </a><span class="php-comment">     * @access public
</span><a href="#2506" id="2506" class="l">2506: </a><span class="php-comment">     * @param string $key_filename Parameter File Name
</span><a href="#2507" id="2507" class="l">2507: </a><span class="php-comment">     * @param string $key_pass Password for private key
</span><a href="#2508" id="2508" class="l">2508: </a><span class="php-comment">     */</span>
<a href="#2509" id="2509" class="l">2509: </a>
<a href="#2510" id="2510" class="l">2510: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> DKIM_QP(<span class="php-var">$txt</span>)
<a href="#2511" id="2511" class="l">2511: </a>    {
<a href="#2512" id="2512" class="l">2512: </a>        <span class="php-var">$tmp</span> = <span class="php-quote">&quot;&quot;</span>;
<a href="#2513" id="2513" class="l">2513: </a>        <span class="php-var">$line</span> = <span class="php-quote">&quot;&quot;</span>;
<a href="#2514" id="2514" class="l">2514: </a>        <span class="php-keyword1">for</span> (<span class="php-var">$i</span> = <span class="php-num">0</span>; <span class="php-var">$i</span> &lt; <span class="php-keyword2">strlen</span>(<span class="php-var">$txt</span>); <span class="php-var">$i</span>++) {
<a href="#2515" id="2515" class="l">2515: </a>            <span class="php-var">$ord</span> = <span class="php-keyword2">ord</span>(<span class="php-var">$txt</span>[<span class="php-var">$i</span>]);
<a href="#2516" id="2516" class="l">2516: </a>            <span class="php-keyword1">if</span> (((<span class="php-num">0x21</span> &lt;= <span class="php-var">$ord</span>) &amp;&amp; (<span class="php-var">$ord</span> &lt;= <span class="php-num">0x3A</span>)) || <span class="php-var">$ord</span> == <span class="php-num">0x3C</span>
<a href="#2517" id="2517" class="l">2517: </a>                    || ((<span class="php-num">0x3E</span> &lt;= <span class="php-var">$ord</span>) &amp;&amp; (<span class="php-var">$ord</span> &lt;= <span class="php-num">0x7E</span>))) {
<a href="#2518" id="2518" class="l">2518: </a>                <span class="php-var">$line</span> .= <span class="php-var">$txt</span>[<span class="php-var">$i</span>];
<a href="#2519" id="2519" class="l">2519: </a>            } <span class="php-keyword1">else</span> {
<a href="#2520" id="2520" class="l">2520: </a>                <span class="php-var">$line</span> .= <span class="php-quote">&quot;=&quot;</span> . <span class="php-keyword2">sprintf</span>(<span class="php-quote">&quot;%02X&quot;</span>, <span class="php-var">$ord</span>);
<a href="#2521" id="2521" class="l">2521: </a>            }
<a href="#2522" id="2522" class="l">2522: </a>        }
<a href="#2523" id="2523" class="l">2523: </a>        <span class="php-keyword1">return</span> <span class="php-var">$line</span>;
<a href="#2524" id="2524" class="l">2524: </a>    }
<a href="#2525" id="2525" class="l">2525: </a>
<a href="#2526" id="2526" class="l">2526: </a>    <span class="php-comment">/**
</span><a href="#2527" id="2527" class="l">2527: </a><span class="php-comment">     * Generate DKIM signature
</span><a href="#2528" id="2528" class="l">2528: </a><span class="php-comment">     *
</span><a href="#2529" id="2529" class="l">2529: </a><span class="php-comment">     * @access public
</span><a href="#2530" id="2530" class="l">2530: </a><span class="php-comment">     * @param string $s Header
</span><a href="#2531" id="2531" class="l">2531: </a><span class="php-comment">     */</span>
<a href="#2532" id="2532" class="l">2532: </a>
<a href="#2533" id="2533" class="l">2533: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> DKIM_Sign(<span class="php-var">$s</span>)
<a href="#2534" id="2534" class="l">2534: </a>    {
<a href="#2535" id="2535" class="l">2535: </a>        <span class="php-var">$privKeyStr</span> = <span class="php-keyword2">file_get_contents</span>(<span class="php-var">$this</span>-&gt;DKIM_private);
<a href="#2536" id="2536" class="l">2536: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;DKIM_passphrase != <span class="php-quote">''</span>) {
<a href="#2537" id="2537" class="l">2537: </a>            <span class="php-var">$privKey</span> = <span class="php-keyword2">openssl_pkey_get_private</span>(<span class="php-var">$privKeyStr</span>,
<a href="#2538" id="2538" class="l">2538: </a>                    <span class="php-var">$this</span>-&gt;DKIM_passphrase);
<a href="#2539" id="2539" class="l">2539: </a>        } <span class="php-keyword1">else</span> {
<a href="#2540" id="2540" class="l">2540: </a>            <span class="php-var">$privKey</span> = <span class="php-var">$privKeyStr</span>;
<a href="#2541" id="2541" class="l">2541: </a>        }
<a href="#2542" id="2542" class="l">2542: </a>        <span class="php-keyword1">if</span> (<span class="php-keyword2">openssl_sign</span>(<span class="php-var">$s</span>, <span class="php-var">$signature</span>, <span class="php-var">$privKey</span>)) {
<a href="#2543" id="2543" class="l">2543: </a>            <span class="php-keyword1">return</span> <span class="php-keyword2">base64_encode</span>(<span class="php-var">$signature</span>);
<a href="#2544" id="2544" class="l">2544: </a>        }
<a href="#2545" id="2545" class="l">2545: </a>    }
<a href="#2546" id="2546" class="l">2546: </a>
<a href="#2547" id="2547" class="l">2547: </a>    <span class="php-comment">/**
</span><a href="#2548" id="2548" class="l">2548: </a><span class="php-comment">     * Generate DKIM Canonicalization Header
</span><a href="#2549" id="2549" class="l">2549: </a><span class="php-comment">     *
</span><a href="#2550" id="2550" class="l">2550: </a><span class="php-comment">     * @access public
</span><a href="#2551" id="2551" class="l">2551: </a><span class="php-comment">     * @param string $s Header
</span><a href="#2552" id="2552" class="l">2552: </a><span class="php-comment">     */</span>
<a href="#2553" id="2553" class="l">2553: </a>
<a href="#2554" id="2554" class="l">2554: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> DKIM_HeaderC(<span class="php-var">$s</span>)
<a href="#2555" id="2555" class="l">2555: </a>    {
<a href="#2556" id="2556" class="l">2556: </a>        <span class="php-var">$s</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">&quot;/\r\n\s+/&quot;</span>, <span class="php-quote">&quot; &quot;</span>, <span class="php-var">$s</span>);
<a href="#2557" id="2557" class="l">2557: </a>        <span class="php-var">$lines</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">&quot;\r\n&quot;</span>, <span class="php-var">$s</span>);
<a href="#2558" id="2558" class="l">2558: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$lines</span> <span class="php-keyword1">as</span> <span class="php-var">$key</span> =&gt; <span class="php-var">$line</span>) {
<a href="#2559" id="2559" class="l">2559: </a>            <span class="php-keyword1">list</span>(<span class="php-var">$heading</span>, <span class="php-var">$value</span>) = <span class="php-keyword2">explode</span>(<span class="php-quote">&quot;:&quot;</span>, <span class="php-var">$line</span>, <span class="php-num">2</span>);
<a href="#2560" id="2560" class="l">2560: </a>            <span class="php-var">$heading</span> = <span class="php-keyword2">strtolower</span>(<span class="php-var">$heading</span>);
<a href="#2561" id="2561" class="l">2561: </a>            <span class="php-var">$value</span> = <span class="php-keyword2">preg_replace</span>(<span class="php-quote">&quot;/\s+/&quot;</span>, <span class="php-quote">&quot; &quot;</span>, <span class="php-var">$value</span>); <span class="php-comment">// Compress useless spaces</span>
<a href="#2562" id="2562" class="l">2562: </a>            <span class="php-var">$lines</span>[<span class="php-var">$key</span>] = <span class="php-var">$heading</span> . <span class="php-quote">&quot;:&quot;</span> . <span class="php-keyword2">trim</span>(<span class="php-var">$value</span>); <span class="php-comment">// Don't forget to remove WSP around the value</span>
<a href="#2563" id="2563" class="l">2563: </a>        }
<a href="#2564" id="2564" class="l">2564: </a>        <span class="php-var">$s</span> = <span class="php-keyword2">implode</span>(<span class="php-quote">&quot;\r\n&quot;</span>, <span class="php-var">$lines</span>);
<a href="#2565" id="2565" class="l">2565: </a>        <span class="php-keyword1">return</span> <span class="php-var">$s</span>;
<a href="#2566" id="2566" class="l">2566: </a>    }
<a href="#2567" id="2567" class="l">2567: </a>
<a href="#2568" id="2568" class="l">2568: </a>    <span class="php-comment">/**
</span><a href="#2569" id="2569" class="l">2569: </a><span class="php-comment">     * Generate DKIM Canonicalization Body
</span><a href="#2570" id="2570" class="l">2570: </a><span class="php-comment">     *
</span><a href="#2571" id="2571" class="l">2571: </a><span class="php-comment">     * @access public
</span><a href="#2572" id="2572" class="l">2572: </a><span class="php-comment">     * @param string $body Message Body
</span><a href="#2573" id="2573" class="l">2573: </a><span class="php-comment">     */</span>
<a href="#2574" id="2574" class="l">2574: </a>
<a href="#2575" id="2575" class="l">2575: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> DKIM_BodyC(<span class="php-var">$body</span>)
<a href="#2576" id="2576" class="l">2576: </a>    {
<a href="#2577" id="2577" class="l">2577: </a>        <span class="php-keyword1">if</span> (<span class="php-var">$body</span> == <span class="php-quote">''</span>)
<a href="#2578" id="2578" class="l">2578: </a>            <span class="php-keyword1">return</span> <span class="php-quote">&quot;\r\n&quot;</span>;
<a href="#2579" id="2579" class="l">2579: </a>        <span class="php-comment">// stabilize line endings</span>
<a href="#2580" id="2580" class="l">2580: </a>        <span class="php-var">$body</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\r\n&quot;</span>, <span class="php-quote">&quot;\n&quot;</span>, <span class="php-var">$body</span>);
<a href="#2581" id="2581" class="l">2581: </a>        <span class="php-var">$body</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">&quot;\n&quot;</span>, <span class="php-quote">&quot;\r\n&quot;</span>, <span class="php-var">$body</span>);
<a href="#2582" id="2582" class="l">2582: </a>        <span class="php-comment">// END stabilize line endings</span>
<a href="#2583" id="2583" class="l">2583: </a>        <span class="php-keyword1">while</span> (<span class="php-keyword2">substr</span>(<span class="php-var">$body</span>, <span class="php-keyword2">strlen</span>(<span class="php-var">$body</span>) - <span class="php-num">4</span>, <span class="php-num">4</span>) == <span class="php-quote">&quot;\r\n\r\n&quot;</span>) {
<a href="#2584" id="2584" class="l">2584: </a>            <span class="php-var">$body</span> = <span class="php-keyword2">substr</span>(<span class="php-var">$body</span>, <span class="php-num">0</span>, <span class="php-keyword2">strlen</span>(<span class="php-var">$body</span>) - <span class="php-num">2</span>);
<a href="#2585" id="2585" class="l">2585: </a>        }
<a href="#2586" id="2586" class="l">2586: </a>        <span class="php-keyword1">return</span> <span class="php-var">$body</span>;
<a href="#2587" id="2587" class="l">2587: </a>    }
<a href="#2588" id="2588" class="l">2588: </a>
<a href="#2589" id="2589" class="l">2589: </a>    <span class="php-comment">/**
</span><a href="#2590" id="2590" class="l">2590: </a><span class="php-comment">     * Create the DKIM header, body, as new header
</span><a href="#2591" id="2591" class="l">2591: </a><span class="php-comment">     *
</span><a href="#2592" id="2592" class="l">2592: </a><span class="php-comment">     * @access public
</span><a href="#2593" id="2593" class="l">2593: </a><span class="php-comment">     * @param string $headers_line Header lines
</span><a href="#2594" id="2594" class="l">2594: </a><span class="php-comment">     * @param string $subject Subject
</span><a href="#2595" id="2595" class="l">2595: </a><span class="php-comment">     * @param string $body Body
</span><a href="#2596" id="2596" class="l">2596: </a><span class="php-comment">     */</span>
<a href="#2597" id="2597" class="l">2597: </a>
<a href="#2598" id="2598" class="l">2598: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> DKIM_Add(<span class="php-var">$headers_line</span>, <span class="php-var">$subject</span>, <span class="php-var">$body</span>)
<a href="#2599" id="2599" class="l">2599: </a>    {
<a href="#2600" id="2600" class="l">2600: </a>        <span class="php-var">$DKIMsignatureType</span> = <span class="php-quote">'rsa-sha1'</span>; <span class="php-comment">// Signature &amp; hash algorithms</span>
<a href="#2601" id="2601" class="l">2601: </a>        <span class="php-var">$DKIMcanonicalization</span> = <span class="php-quote">'relaxed/simple'</span>; <span class="php-comment">// Canonicalization of header/body</span>
<a href="#2602" id="2602" class="l">2602: </a>        <span class="php-var">$DKIMquery</span> = <span class="php-quote">'dns/txt'</span>; <span class="php-comment">// Query method</span>
<a href="#2603" id="2603" class="l">2603: </a>        <span class="php-var">$DKIMtime</span> = <span class="php-keyword2">time</span>(); <span class="php-comment">// Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)</span>
<a href="#2604" id="2604" class="l">2604: </a>        <span class="php-var">$subject_header</span> = <span class="php-quote">&quot;Subject: </span><span class="php-var">$subject</span><span class="php-quote">&quot;</span>;
<a href="#2605" id="2605" class="l">2605: </a>        <span class="php-var">$headers</span> = <span class="php-keyword2">explode</span>(<span class="php-quote">&quot;\r\n&quot;</span>, <span class="php-var">$headers_line</span>);
<a href="#2606" id="2606" class="l">2606: </a>        <span class="php-keyword1">foreach</span> (<span class="php-var">$headers</span> <span class="php-keyword1">as</span> <span class="php-var">$header</span>) {
<a href="#2607" id="2607" class="l">2607: </a>            <span class="php-keyword1">if</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$header</span>, <span class="php-quote">'From:'</span>) === <span class="php-num">0</span>) {
<a href="#2608" id="2608" class="l">2608: </a>                <span class="php-var">$from_header</span> = <span class="php-var">$header</span>;
<a href="#2609" id="2609" class="l">2609: </a>            } <span class="php-keyword1">elseif</span> (<span class="php-keyword2">strpos</span>(<span class="php-var">$header</span>, <span class="php-quote">'To:'</span>) === <span class="php-num">0</span>) {
<a href="#2610" id="2610" class="l">2610: </a>                <span class="php-var">$to_header</span> = <span class="php-var">$header</span>;
<a href="#2611" id="2611" class="l">2611: </a>            }
<a href="#2612" id="2612" class="l">2612: </a>        }
<a href="#2613" id="2613" class="l">2613: </a>        <span class="php-var">$from</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">'|'</span>, <span class="php-quote">'=7C'</span>, <span class="php-var">$this</span>-&gt;DKIM_QP(<span class="php-var">$from_header</span>));
<a href="#2614" id="2614" class="l">2614: </a>        <span class="php-var">$to</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">'|'</span>, <span class="php-quote">'=7C'</span>, <span class="php-var">$this</span>-&gt;DKIM_QP(<span class="php-var">$to_header</span>));
<a href="#2615" id="2615" class="l">2615: </a>        <span class="php-var">$subject</span> = <span class="php-keyword2">str_replace</span>(<span class="php-quote">'|'</span>, <span class="php-quote">'=7C'</span>, <span class="php-var">$this</span>-&gt;DKIM_QP(<span class="php-var">$subject_header</span>)); <span class="php-comment">// Copied header fields (dkim-quoted-printable</span>
<a href="#2616" id="2616" class="l">2616: </a>        <span class="php-var">$body</span> = <span class="php-var">$this</span>-&gt;DKIM_BodyC(<span class="php-var">$body</span>);
<a href="#2617" id="2617" class="l">2617: </a>        <span class="php-var">$DKIMlen</span> = <span class="php-keyword2">strlen</span>(<span class="php-var">$body</span>); <span class="php-comment">// Length of body</span>
<a href="#2618" id="2618" class="l">2618: </a>        <span class="php-var">$DKIMb64</span> = <span class="php-keyword2">base64_encode</span>(<span class="php-keyword2">pack</span>(<span class="php-quote">&quot;H*&quot;</span>, <span class="php-keyword2">sha1</span>(<span class="php-var">$body</span>))); <span class="php-comment">// Base64 of packed binary SHA-1 hash of body</span>
<a href="#2619" id="2619" class="l">2619: </a>        <span class="php-var">$ident</span> = (<span class="php-var">$this</span>-&gt;DKIM_identity == <span class="php-quote">''</span>) ? <span class="php-quote">''</span>
<a href="#2620" id="2620" class="l">2620: </a>                : <span class="php-quote">&quot; i=&quot;</span> . <span class="php-var">$this</span>-&gt;DKIM_identity . <span class="php-quote">&quot;;&quot;</span>;
<a href="#2621" id="2621" class="l">2621: </a>        <span class="php-var">$dkimhdrs</span> = <span class="php-quote">&quot;DKIM-Signature: v=1; a=&quot;</span> . <span class="php-var">$DKIMsignatureType</span> . <span class="php-quote">&quot;; q=&quot;</span>
<a href="#2622" id="2622" class="l">2622: </a>                . <span class="php-var">$DKIMquery</span> . <span class="php-quote">&quot;; l=&quot;</span> . <span class="php-var">$DKIMlen</span> . <span class="php-quote">&quot;; s=&quot;</span>
<a href="#2623" id="2623" class="l">2623: </a>                . <span class="php-var">$this</span>-&gt;DKIM_selector . <span class="php-quote">&quot;;\r\n&quot;</span> . <span class="php-quote">&quot;\tt=&quot;</span> . <span class="php-var">$DKIMtime</span> . <span class="php-quote">&quot;; c=&quot;</span>
<a href="#2624" id="2624" class="l">2624: </a>                . <span class="php-var">$DKIMcanonicalization</span> . <span class="php-quote">&quot;;\r\n&quot;</span> . <span class="php-quote">&quot;\th=From:To:Subject;\r\n&quot;</span>
<a href="#2625" id="2625" class="l">2625: </a>                . <span class="php-quote">&quot;\td=&quot;</span> . <span class="php-var">$this</span>-&gt;DKIM_domain . <span class="php-quote">&quot;;&quot;</span> . <span class="php-var">$ident</span> . <span class="php-quote">&quot;\r\n&quot;</span>
<a href="#2626" id="2626" class="l">2626: </a>                . <span class="php-quote">&quot;\tz=</span><span class="php-var">$from</span><span class="php-quote">\r\n&quot;</span> . <span class="php-quote">&quot;\t|</span><span class="php-var">$to</span><span class="php-quote">\r\n&quot;</span> . <span class="php-quote">&quot;\t|</span><span class="php-var">$subject</span><span class="php-quote">;\r\n&quot;</span> . <span class="php-quote">&quot;\tbh=&quot;</span>
<a href="#2627" id="2627" class="l">2627: </a>                . <span class="php-var">$DKIMb64</span> . <span class="php-quote">&quot;;\r\n&quot;</span> . <span class="php-quote">&quot;\tb=&quot;</span>;
<a href="#2628" id="2628" class="l">2628: </a>        <span class="php-var">$toSign</span> = <span class="php-var">$this</span>-&gt;DKIM_HeaderC(
<a href="#2629" id="2629" class="l">2629: </a>                        <span class="php-var">$from_header</span> . <span class="php-quote">&quot;\r\n&quot;</span> . <span class="php-var">$to_header</span> . <span class="php-quote">&quot;\r\n&quot;</span>
<a href="#2630" id="2630" class="l">2630: </a>                                . <span class="php-var">$subject_header</span> . <span class="php-quote">&quot;\r\n&quot;</span> . <span class="php-var">$dkimhdrs</span>);
<a href="#2631" id="2631" class="l">2631: </a>        <span class="php-var">$signed</span> = <span class="php-var">$this</span>-&gt;DKIM_Sign(<span class="php-var">$toSign</span>);
<a href="#2632" id="2632" class="l">2632: </a>        <span class="php-keyword1">return</span> <span class="php-quote">&quot;X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n&quot;</span> . <span class="php-var">$dkimhdrs</span>
<a href="#2633" id="2633" class="l">2633: </a>                . <span class="php-var">$signed</span> . <span class="php-quote">&quot;\r\n&quot;</span>;
<a href="#2634" id="2634" class="l">2634: </a>    }
<a href="#2635" id="2635" class="l">2635: </a>
<a href="#2636" id="2636" class="l">2636: </a>    <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> doCallback(<span class="php-var">$isSent</span>, <span class="php-var">$to</span>, <span class="php-var">$cc</span>, <span class="php-var">$bcc</span>, <span class="php-var">$subject</span>, <span class="php-var">$body</span>)
<a href="#2637" id="2637" class="l">2637: </a>    {
<a href="#2638" id="2638" class="l">2638: </a>        <span class="php-keyword1">if</span> (!<span class="php-keyword1">empty</span>(<span class="php-var">$this</span>-&gt;action_function)
<a href="#2639" id="2639" class="l">2639: </a>                &amp;&amp; <span class="php-keyword2">function_exists</span>(<span class="php-var">$this</span>-&gt;action_function)) {
<a href="#2640" id="2640" class="l">2640: </a>            <span class="php-var">$params</span> = <span class="php-keyword1">array</span>(
<a href="#2641" id="2641" class="l">2641: </a>                    <span class="php-var">$isSent</span>,
<a href="#2642" id="2642" class="l">2642: </a>                    <span class="php-var">$to</span>,
<a href="#2643" id="2643" class="l">2643: </a>                    <span class="php-var">$cc</span>,
<a href="#2644" id="2644" class="l">2644: </a>                    <span class="php-var">$bcc</span>,
<a href="#2645" id="2645" class="l">2645: </a>                    <span class="php-var">$subject</span>,
<a href="#2646" id="2646" class="l">2646: </a>                    <span class="php-var">$body</span>
<a href="#2647" id="2647" class="l">2647: </a>            );
<a href="#2648" id="2648" class="l">2648: </a>            <span class="php-keyword2">call_user_func_array</span>(<span class="php-var">$this</span>-&gt;action_function, <span class="php-var">$params</span>);
<a href="#2649" id="2649" class="l">2649: </a>        }
<a href="#2650" id="2650" class="l">2650: </a>    }
<a href="#2651" id="2651" class="l">2651: </a>}
<a href="#2652" id="2652" class="l">2652: </a>
<a href="#2653" id="2653" class="l">2653: </a><span class="php-keyword1">class</span> phpmailerException <span class="php-keyword1">extends</span> Exception
<a href="#2654" id="2654" class="l">2654: </a>{
<a href="#2655" id="2655" class="l">2655: </a>
<a href="#2656" id="2656" class="l">2656: </a>    <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> errorMessage()
<a href="#2657" id="2657" class="l">2657: </a>    {
<a href="#2658" id="2658" class="l">2658: </a>        <span class="php-var">$errorMsg</span> = <span class="php-quote">'&lt;strong&gt;'</span> . <span class="php-var">$this</span>-&gt;getMessage() . <span class="php-quote">&quot;&lt;/strong&gt;&lt;br /&gt;\n&quot;</span>;
<a href="#2659" id="2659" class="l">2659: </a>        <span class="php-keyword1">return</span> <span class="php-var">$errorMsg</span>;
<a href="#2660" id="2660" class="l">2660: </a>    }
<a href="#2661" id="2661" class="l">2661: </a>}
<a href="#2662" id="2662" class="l">2662: </a><span class="xlang">?&gt;</span>
<a href="#2663" id="2663" class="l">2663: </a></code></pre>

	<div id="footer">
		nort API documentation generated by <a href="http://apigen.org">ApiGen 2.7.0</a>
	</div>
</div>
</div>
</body>
</html>
